Internal Component Libraries
LEDs, Switches & LED Display
There are on-board switches and LEDs you may use. Furthermore, you can interface your board to external LEDs or switches as well.
#include "io.hpp"
void led_sw()
{
/* Check if button 1 is pressed */
if (SW.getSwitch(1))
{
/* Turn on LED # 1 */
LE.on(1);
/* LED display will show "1" */
LD.setNumber(1);
}
else
{
/* Turn off all LEDs */
LE.setAll(0);
/* Clear the display */
LD.clear();
}
}
Sensors
This section provides examples of how to read data values from the sensors.
#include "io.hpp"
void sensors()
{
/* Read light sensor */
int light_value = LS.getRawValue();
/* Read from accelerometer */
int tilt_x = AS.getX();
int tilt_y = AS.getY();
int tilt_z = AS.getZ();
/* Read from temperature sensor */
int temperature_f = TS.getFarenheit();
}