![](/media/cache/profiles/3ec0e2c7f4536e7ce9e9ce183b1de9e8.jpg.50x50_q85.jpg)
Hello World program for MMA7660
main.cpp@2:0af77f74afb2, 2014-05-13 (annotated)
- Committer:
- Sissors
- Date:
- Tue May 13 18:15:06 2014 +0000
- Revision:
- 2:0af77f74afb2
- Parent:
- 0:bd0546063b0a
updated
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Sissors | 0:bd0546063b0a | 1 | //Uses the measured z-acceleration to drive leds 2 and 3 of the mbed |
Sissors | 0:bd0546063b0a | 2 | |
Sissors | 0:bd0546063b0a | 3 | #include "mbed.h" |
Sissors | 0:bd0546063b0a | 4 | #include "MMA7660.h" |
Sissors | 0:bd0546063b0a | 5 | |
Sissors | 0:bd0546063b0a | 6 | MMA7660 MMA(p28, p27); |
Sissors | 0:bd0546063b0a | 7 | |
Sissors | 0:bd0546063b0a | 8 | DigitalOut connectionLed(LED1); |
Sissors | 0:bd0546063b0a | 9 | PwmOut Zaxis_p(LED2); |
Sissors | 0:bd0546063b0a | 10 | PwmOut Zaxis_n(LED3); |
Sissors | 0:bd0546063b0a | 11 | |
Sissors | 0:bd0546063b0a | 12 | int main() { |
Sissors | 0:bd0546063b0a | 13 | if (MMA.testConnection()) |
Sissors | 0:bd0546063b0a | 14 | connectionLed = 1; |
Sissors | 0:bd0546063b0a | 15 | |
Sissors | 0:bd0546063b0a | 16 | while(1) { |
Sissors | 0:bd0546063b0a | 17 | Zaxis_p = MMA.z(); |
Sissors | 0:bd0546063b0a | 18 | Zaxis_n = -MMA.z(); |
Sissors | 0:bd0546063b0a | 19 | } |
Sissors | 0:bd0546063b0a | 20 | |
Sissors | 0:bd0546063b0a | 21 | } |