This program reads the data from the LSM303DLM sensor and output that through the UART port.
Fork of Arch_GPIO_Ex1 by
main.cpp
- Committer:
- zlmun
- Date:
- 2013-11-20
- Revision:
- 1:36d047c1f0f4
- Parent:
- 0:ed40790a022a
File content as of revision 1:36d047c1f0f4:
#include "mbed.h" #include "LSM303DLH.h" //DigitalOut led(LED1); Serial bbb(P1_13,P1_14); //seeedarch pin for the UART communication tx, rx LSM303DLH compass(P0_5, P0_4); //seeedarch pin for I2c communication SDA and SCL //PwmOut servo(P1_24); //seeedarch pin for the multiturn servo int main() { bbb.baud(9600); while(1) { if(compass.read()) { bbb.printf("ACC:%f %f %f, MAG:%f %f %f\n\r",compass.ax, compass.ay, compass.az, compass.mx, compass.my, compass.mz); bbb.printf("Direction = %.0f\n\r", compass.getHeading() * 180 / 3.14159265358979); wait(0.5); } } }