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
xbee_read.cpp
00001 #include "mbed.h" 00002 00003 Serial xbee1(PA_9, PA_10); //was PA_2, PA_3 00004 DigitalOut rst1(PA_11); 00005 DigitalOut myled(LED1); 00006 DigitalIn mybutton(USER_BUTTON); 00007 00008 int main() { 00009 rst1 = 0; //Set reset pin to 0 00010 myled = 0; 00011 wait_ms(1); 00012 rst1 = 1; //Set reset pin to 1 00013 wait_ms(1); 00014 wait(2); 00015 00016 while (1) { 00017 00018 if(xbee1.readable()){ 00019 int a = 0; 00020 a = xbee1.getc(); //XBee read 00021 00022 if (a == 5){ 00023 myled = 1; //blink spastically 00024 // wait(0.2); 00025 // myled = 0; 00026 // wait(0.2); 00027 } 00028 else if (a == 10){ 00029 myled = 0; 00030 //wait(3); 00031 } 00032 else{ 00033 myled = 0; 00034 } 00035 } 00036 } 00037 }
Generated on Fri Jul 15 2022 06:55:41 by
1.7.2