Anoop M
/
xbeetx
XBee Transmiiter Module
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 #include "CMPS03.h" 00003 00004 CMPS03 compass(p9, p10, CMPS03_DEFAULT_I2C_ADDRESS); 00005 Serial pc(USBTX, USBRX); 00006 00007 Serial xbee1(p13,p14); 00008 DigitalOut rst1(p8); //Digital reset for the XBee, 200ns for reset 00009 00010 00011 DigitalOut myled(LED3);//Create variable for Led 3 on the mbed 00012 00013 int main() { 00014 00015 rst1 = 0; //Set reset pin to 0 00016 myled = 0;//Set LED3 to 0 00017 wait_ms(1);//Wait at least one millisecond 00018 rst1 = 1;//Set reset pin to 1 00019 wait_ms(1);//Wait another millisecond 00020 int Y; 00021 00022 while (1) {//Neverending Loop 00023 00024 myled = 1; //Turn Led 3 Off 00025 Y=compass.readBearing(); 00026 00027 printf("data %f \n\r", Y / 10.0); 00028 xbee1.printf("%d", Y); //XBee write whatever the PC is sending 00029 // xbee1.putc(Y); 00030 wait(1); 00031 myled = 0; //Turn Led 3 on for succcessfull communication 00032 wait(1); 00033 } 00034 } 00035
Generated on Sun Jul 31 2022 12:55:52 by 1.7.2