Austin Ward
/
ArduIMUHelloWorld
Test program testing ArduIMU Library
main.cpp@0:ad6a9dab3b2b, 2014-03-24 (annotated)
- Committer:
- ifwui
- Date:
- Mon Mar 24 20:32:29 2014 +0000
- Revision:
- 0:ad6a9dab3b2b
Initial Commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ifwui | 0:ad6a9dab3b2b | 1 | #include "mbed.h" |
ifwui | 0:ad6a9dab3b2b | 2 | #include "Arduimu.h" |
ifwui | 0:ad6a9dab3b2b | 3 | #include <sstream> |
ifwui | 0:ad6a9dab3b2b | 4 | |
ifwui | 0:ad6a9dab3b2b | 5 | Serial pc(USBTX, USBRX); // tx, rx |
ifwui | 0:ad6a9dab3b2b | 6 | Arduimu device(p9, p10); // tx, rx |
ifwui | 0:ad6a9dab3b2b | 7 | |
ifwui | 0:ad6a9dab3b2b | 8 | int main() |
ifwui | 0:ad6a9dab3b2b | 9 | { |
ifwui | 0:ad6a9dab3b2b | 10 | std::stringstream s; |
ifwui | 0:ad6a9dab3b2b | 11 | pc.printf("Starting\r\n"); |
ifwui | 0:ad6a9dab3b2b | 12 | while(1) { |
ifwui | 0:ad6a9dab3b2b | 13 | // device.receive(); |
ifwui | 0:ad6a9dab3b2b | 14 | s << "Got data: (" << device.getRoll() << "," << device.getPitch() << "," << device.getYaw() << ")"; |
ifwui | 0:ad6a9dab3b2b | 15 | pc.printf("%s\r\n",s.str()); |
ifwui | 0:ad6a9dab3b2b | 16 | s.str(""); |
ifwui | 0:ad6a9dab3b2b | 17 | wait(.2); |
ifwui | 0:ad6a9dab3b2b | 18 | } |
ifwui | 0:ad6a9dab3b2b | 19 | } |