mbed workshop intro + cansat examples
Diff: Accel1.cpp
- Revision:
- 0:f309f06aeec7
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Accel1.cpp Thu May 10 21:14:34 2012 +0000 @@ -0,0 +1,18 @@ +#include "mbed.h" + +AnalogIn x(p15); +AnalogIn y(p16); +AnalogIn z(p17); +DigitalIn zeroGDetect(p25); +DigitalOut gSelect(p26); +DigitalOut sleep(p24); + +int main() { + gSelect = 1; // 6g mode + sleep = 1; // do not sleep + + while (true) { + printf("x = %5.3f, y = %5.3f, z = %5.3f\n", x.read(), y.read(), z.read()); + wait(1.0); + } +} \ No newline at end of file