Jonathan Goret
/
Nucleo_gyro_magno
same
main.cpp@0:b70138c005b7, 2015-04-13 (annotated)
- Committer:
- johnylafleur
- Date:
- Mon Apr 13 16:06:18 2015 +0000
- Revision:
- 0:b70138c005b7
same;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
johnylafleur | 0:b70138c005b7 | 1 | #include "mbed.h" |
johnylafleur | 0:b70138c005b7 | 2 | #include "LSM303DLH.h" |
johnylafleur | 0:b70138c005b7 | 3 | |
johnylafleur | 0:b70138c005b7 | 4 | Serial debug(USBTX,USBRX); |
johnylafleur | 0:b70138c005b7 | 5 | LSM303DLH compass(PB_9, PB_8); |
johnylafleur | 0:b70138c005b7 | 6 | |
johnylafleur | 0:b70138c005b7 | 7 | int main() { |
johnylafleur | 0:b70138c005b7 | 8 | float hdg; |
johnylafleur | 0:b70138c005b7 | 9 | debug.format(8,Serial::None,1); |
johnylafleur | 0:b70138c005b7 | 10 | debug.baud(115200); |
johnylafleur | 0:b70138c005b7 | 11 | debug.printf("LSM303DLH Test\x0d\x0a"); |
johnylafleur | 0:b70138c005b7 | 12 | compass.setOffset(29.50, -0.50, 4.00); // example calibration |
johnylafleur | 0:b70138c005b7 | 13 | compass.setScale(1.00, 1.03, 1.21); // example calibration |
johnylafleur | 0:b70138c005b7 | 14 | while(1) { |
johnylafleur | 0:b70138c005b7 | 15 | hdg = compass.heading(); |
johnylafleur | 0:b70138c005b7 | 16 | debug.printf("Heading: %.2f\n", hdg); |
johnylafleur | 0:b70138c005b7 | 17 | wait(0.1); |
johnylafleur | 0:b70138c005b7 | 18 | } |
johnylafleur | 0:b70138c005b7 | 19 | } |