upm  0.4.1
Sensor/Actuator repository for libmraa (v0.8.0)
Public Member Functions | List of all members

API for the Grove Relay. More...

Detailed Description

UPM module for the Grove relay switch. 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.

// Create the button object using UART
for (int i = 0; i < 3; i++) {
relay.on();
if (relay.isOn())
System.out.println("Relay is on");
Thread.sleep(1000);
relay.off();
if (relay.isOff())
System.out.println("Relay is off");
Thread.sleep(1000);
}
groverelay.jpg

Public Member Functions

synchronized void delete ()
 
 GroveRelay (long pin)
 
int on ()
 
int off ()
 
boolean isOn ()
 
boolean isOff ()
 
- Public Member Functions inherited from Grove
synchronized void delete ()
 
String name ()
 

Constructor & Destructor Documentation

GroveRelay ( long  pin)

Grove relay constructor

Parameters
gpioPin to use

Member Function Documentation

boolean isOff ( )

Defines whether the relay switch is open.

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

Defines whether the relay switch is closed.

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

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

Returns
0 if successful, non-zero otherwise
int on ( )

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

Returns
0 if successful, non-zero otherwise
Inheritance diagram for GroveRelay:
Inheritance graph
[legend]
Collaboration diagram for GroveRelay:
Collaboration graph
[legend]

The documentation for this class was generated from the following file: