Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed CROTUS_XBee mbed-rtos Crotus_Com
Diff: main.cpp
- Revision:
- 0:28d5622d1a3e
- Child:
- 1:3591e7df4ff4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Mar 12 14:58:06 2017 +0000 @@ -0,0 +1,31 @@ +#include "mbed.h" +#include "Magneto.h" +#include "Acc.h" + +DigitalOut myled(LED1); + +I2C i2c(p28, p27); + +Magneto magneto(i2c); +Acc acc(i2c); + +Serial pc(USBTX, USBRX); + +int main() { + if(!magneto.Test() || !acc.Test()){ + pc.printf("SCRUB!!\r\n"); + return -1; + } + + magneto.ActivateDevice(); + acc.ActivateDevice(); + + wait(0.2); + + while(true){ + int16_t heading = magneto.GetHeadingXY(); + int16_t inclination = acc.GetInclinationYZ(); + pc.printf("Heading : %d, Inclination : %d\r\n", heading, inclination); + wait(0.1); + } +}