Glove with light ring which plays http://www.raiden-x.net/
Dependencies: Adafruit_NeoPixel MMA8451Q USBDevice mbed
Fork of Raiden by
main.cpp@3:f2d3e041d8f2, 2012-10-12 (annotated)
- Committer:
- chris
- Date:
- Fri Oct 12 11:31:29 2012 +0000
- Revision:
- 3:f2d3e041d8f2
- Parent:
- 2:41db78380a6e
- Child:
- 4:367de1084ea9
Changed axis readings to return a signed normalised float; Changed hello world program to change RGB LED
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chris | 2:41db78380a6e | 1 | #include "mbed.h" |
chris | 2:41db78380a6e | 2 | #include "MMA8451Q.h" |
chris | 2:41db78380a6e | 3 | |
chris | 2:41db78380a6e | 4 | #define MMA8451_I2C_ADDRESS (0x1d<<1) |
chris | 2:41db78380a6e | 5 | |
chris | 3:f2d3e041d8f2 | 6 | MMA8451Q acc(P_E25, P_E24, MMA8451_I2C_ADDRESS); |
chris | 3:f2d3e041d8f2 | 7 | PwmOut rled(LED_RED); |
chris | 3:f2d3e041d8f2 | 8 | PwmOut gled(LED_GREEN); |
chris | 3:f2d3e041d8f2 | 9 | PwmOut bled(LED_BLUE); |
chris | 3:f2d3e041d8f2 | 10 | |
chris | 2:41db78380a6e | 11 | int main(void) { |
chris | 3:f2d3e041d8f2 | 12 | |
chris | 3:f2d3e041d8f2 | 13 | while (true) { |
chris | 3:f2d3e041d8f2 | 14 | rled = 1.0 - abs(acc.getAccX()); |
chris | 3:f2d3e041d8f2 | 15 | gled = 1.0 - abs(acc.getAccY()); |
chris | 3:f2d3e041d8f2 | 16 | bled = 1.0 - abs(acc.getAccZ()); |
chris | 3:f2d3e041d8f2 | 17 | wait(0.1); |
chris | 2:41db78380a6e | 18 | } |
chris | 2:41db78380a6e | 19 | } |