library for m3Dpi robot, based on the Pololu 3pi and m3pi. m3Dpi has multiple distance sensors, gyroscope, compass and accelerometer sensor to be fully aware of its environment. With the addition of xbee or nrf24n01 module it has wireless communication capabilities.
Dependencies: m3pi ADXL345_I2C HMC5583L ITG3200 PCA9547 TLC59116 VL6180x RGB-fun xbee
lib/StatusLed.cpp@0:9f02ae958e20, 2015-12-03 (annotated)
- Committer:
- sillevl
- Date:
- Thu Dec 03 07:58:50 2015 +0000
- Revision:
- 0:9f02ae958e20
- Child:
- 5:a75574090b59
initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sillevl | 0:9f02ae958e20 | 1 | |
sillevl | 0:9f02ae958e20 | 2 | #include "StatusLed.h" |
sillevl | 0:9f02ae958e20 | 3 | |
sillevl | 0:9f02ae958e20 | 4 | StatusLed::StatusLed(PinName r_pin, PinName g_pin, PinName b_pin) : r_out(r_pin), g_out(g_pin), b_out(b_pin) |
sillevl | 0:9f02ae958e20 | 5 | { |
sillevl | 0:9f02ae958e20 | 6 | |
sillevl | 0:9f02ae958e20 | 7 | } |
sillevl | 0:9f02ae958e20 | 8 | |
sillevl | 0:9f02ae958e20 | 9 | void StatusLed::setColor(Color* color){ |
sillevl | 0:9f02ae958e20 | 10 | r_out = !color->getRed(); |
sillevl | 0:9f02ae958e20 | 11 | g_out = !color->getGreen(); |
sillevl | 0:9f02ae958e20 | 12 | b_out = !color->getBlue(); |
sillevl | 0:9f02ae958e20 | 13 | } |
sillevl | 0:9f02ae958e20 | 14 | |
sillevl | 0:9f02ae958e20 | 15 | void StatusLed::setColor(int color){ |
sillevl | 0:9f02ae958e20 | 16 | setColor(new Color(color)); |
sillevl | 0:9f02ae958e20 | 17 | } |
sillevl | 0:9f02ae958e20 | 18 | |
sillevl | 0:9f02ae958e20 | 19 | void StatusLed::off(){ |
sillevl | 0:9f02ae958e20 | 20 | setColor(Color::BLACK); |
sillevl | 0:9f02ae958e20 | 21 | } |