pyupm_grove module

class pyupm_grove.Grove[source]

Bases: object

name()[source]

std::string name()

class pyupm_grove.GroveButton(pin)[source]

Bases: pyupm_grove.Grove

API for the Grove Button.

Deprecated This class is being replaced by the upm-button library and the Button class.

ID: grovebutton

Name: Button

Other Names: Grove Touch Sensor

Category: button touch

Manufacturer: seeed

Connection: gpio

Kit: gsk Basic UPM module for the Grove button

C++ includes: grovebutton.hpp

installISR(level, isr, arg)[source]

void installISR(mraa::Edge level, void(*isr)(void *), void *arg)

Installs an interrupt service routine (ISR) to be called when the button is activated or deactivated.

fptr: Pointer to a function to be called on interrupt

arg: Pointer to an object to be supplied as an argument to the ISR.

name()[source]

std::string name()

Gets the name of the sensor

Name of this sensor

uninstallISR()[source]

void uninstallISR()

Uninstalls the previously installed ISR

value()[source]

int value()

Gets the value from the GPIO pin

Value from the GPIO pin

class pyupm_grove.GroveLed(pin)[source]

Bases: pyupm_grove.Grove

API for the Grove LED.

Deprecated This class is being replaced by the upm-led library and the Led class.

ID: groveled

Name: LED

Category: led

Manufacturer: seeed

Connection: gpio

Kit: gsk UPM module for the Grove LED (or other similar light- emitting diodes). An LED is a small lightbulb that emits light in response to a small current. The longer wire of an LED connects to the positive seat (anode); the shorter wire connects to the negative seat (cathode). The flat side of the bulb corresponds to the cathode, while the rounded side corresponds to the anode.

C++ includes: groveled.hpp

off()[source]

mraa_result_t off()

Turns the LED off

0 if successful, non-zero otherwise

on()[source]

mraa_result_t on()

Turns the LED on

0 if successful, non-zero otherwise

write(value)[source]

mraa_result_t write(int value)

Turns the LED on or off, depending on the value. If the value is positive (greater than or equal to 1), the LED is turned on. Otherwise, for 0 or negative values, the LED is turned off.

value: Tells the LED to turn on (for values >=1) or off (for values <1)

0 if successful, non-zero otherwise

class pyupm_grove.GroveLight(pin)[source]

Bases: pyupm_grove.Grove

API for the Grove Light Sensor.

Deprecated This class is being replaced by the upm-light library and the Light class.

ID: grovelight

Name: Light Sensor

Category: light

Manufacturer: seeed

Connection: analog

Kit: gsk The Grove light sensor detects the intensity of the ambient light. As the light intensity of the environment increases, the resistance of the sensor decreases. This means the raw value from the analog pin is larger in bright light and smaller in the dark. An approximate lux value can also be returned.

C++ includes: grovelight.hpp

raw_value()[source]

float raw_value()

Gets the raw value from the AIO pin

Raw value from the ADC

value()[source]

int value()

Gets an approximate light value, in lux, from the sensor

Normalized light reading in lux

class pyupm_grove.GroveRelay(pin)[source]

Bases: pyupm_grove.Grove

API for the Grove Relay.

Deprecated This class is being replaced by the upm-relay library and the Relay class.

ID: groverelay

Name: Relay

Category: relay

Manufacturer: seeed

Connection: gpio

Kit: gsk eak hak UPM module for the Grove relay switch. The Grove relay is a digital normally-open switch that uses low voltage or current to control a higher voltage and/or higher current. When closed, the indicator LED lights up and current is allowed to flow.

C++ includes: groverelay.hpp

isOff()[source]

bool isOff()

Defines whether the relay switch is open.

True if the switch is off (open), false otherwise

isOn()[source]

bool isOn()

Defines whether the relay switch is closed.

True if the switch is on (closed), false otherwise

off()[source]

mraa_result_t off()

Sets the relay switch to off (open). This stops current from flowing and the indicator LED is not lit.

0 if successful, non-zero otherwise

on()[source]

mraa_result_t on()

Sets the relay switch to on (closed). This allows current to flow and lights up the indicator LED.

0 if successful, non-zero otherwise

class pyupm_grove.GroveRotary(pin)[source]

Bases: pyupm_grove.Grove

API for the Grove Rotary Angle Sensor (Knob)

Deprecated This class is being replaced by the upm-rotary library and the Rotary class.

ID: groverotary

Name: Rotary Angle Sensor

Other Names: Rotary Potentiometer

Category: ainput

Manufacturer: seeed

Connection: analog

Kit: gsk Basic UPM module for the Grove rotary angle sensor (knob) on analog. Provides a set of functions to read the absolute pin value, degrees or radians, and another set to do the same relative to the center of the knob’s range.

C++ includes: groverotary.hpp

abs_deg()[source]

float abs_deg()

Gets absolute raw degrees from the AIO pin

Unsigned degrees from the ADC

abs_rad()[source]

float abs_rad()

Gets absolute raw radians from the AIO pin

Unsigned radians from the ADC

abs_value()[source]

float abs_value()

Gets the absolute raw value from the AIO pin

Unsigned value from the ADC

rel_deg()[source]

float rel_deg()

Gets relative degrees from the AIO pin

Signed degrees from the ADC

rel_rad()[source]

float rel_rad()

Gets relative radians from the AIO pin

Signed radians from the ADC

rel_value()[source]

float rel_value()

Gets the relative value from the AIO pin

Signed value from the ADC

class pyupm_grove.GroveSlide(pin, ref_voltage=5.0)[source]

Bases: pyupm_grove.Grove

API for the Grove Slide Potentiometer.

Deprecated This class is being replaced by the upm-slide library and the Slide class.

ID: groveslide

Name: Slide Potentiometer

Category: ainput

Manufacturer: seeed

Connection: analog Basic UPM module for the Grove slide potentiometer on analog that returns either a raw value or a scaled voltage value.

C++ includes: groveslide.hpp

raw_value()[source]

float raw_value()

Gets the raw value from the AIO pin

Raw value from the ADC

ref_voltage()[source]

float ref_voltage()

Gets the board’s reference voltage passed on object initialization

Reference voltage the class was set for

voltage_value()[source]

float voltage_value()

Gets the voltage value from the pin

Voltage reading based on the reference voltage

class pyupm_grove.GroveTemp(pin, scale=1.0, r0=100000, b=4275)[source]

Bases: pyupm_grove.Grove

API for the Grove Temperature Sensor.

Deprecated This class is being replaced by the upm-temperature library and the Temperature class.

ID: grovetemp

Name: Temperature Sensor

Category: temp

Manufacturer: seeed

Connection: analog

Kit: gsk Basic UPM module for the Grove temperature sensor on analog. This sensor uses a thermistor to measure ambient temperature. The conversion formula has been updated to work with versions 1.1 and 1.2 of the sensor. For the older v1.0 sensor you will have to specify R0 and B values when initializing the device. The range of this sensor is -40 to 125 C and accuracy is +/- 1.5 C.

C++ includes: grovetemp.hpp

raw_value()[source]

float raw_value()

Gets the raw value from the AIO pin

Raw value from the ADC

value()[source]

int value()

Gets the temperature in Celsius from the sensor

Normalized temperature in Celsius