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_write.cpp
00001 #include "mbed.h" 00002 #include "stdio.h" 00003 #include "stdlib.h" 00004 00005 using namespace std; 00006 00007 Serial xbee1(PA_9, PA_10); //was PA_2, PA_3 00008 DigitalOut rst1(PA_11); 00009 DigitalOut myled(LED1); 00010 DigitalIn mybutton(USER_BUTTON); 00011 00012 int counter = 0; 00013 void sendsignal(); 00014 00015 int main() 00016 { 00017 rst1 = 0; //Set reset pin to 0 00018 myled = 0; 00019 wait_ms(1); 00020 rst1 = 1; //Set reset pin to 1 00021 wait_ms(1); 00022 wait(2); 00023 00024 //* 00025 myled = 1; 00026 while (1) 00027 { 00028 xbee1.putc(65); 00029 } 00030 00031 /* 00032 xbee1.puts("+++"); 00033 wait(2); 00034 xbee1.puts("ATDL40C82BD3\n"); 00035 wait(2); 00036 xbee1.puts("ATCN\n"); 00037 wait(2); 00038 xbee1.puts("sending to xbee with adress 40C82BD3"); 00039 myled = 0; 00040 /* 00041 xbee1.puts("+++"); 00042 wait(2); 00043 xbee1.puts("ATDL409F1337\n"); 00044 wait(2); 00045 xbee1.puts("ATCN\n"); 00046 wait(2); 00047 xbee1.puts("sending to xbee with adress 409F1337"); 00048 myled = 1; 00049 00050 xbee1.puts("+++"); 00051 wait(2); 00052 xbee1.puts("ATDL409F7454\n"); 00053 wait(2); 00054 xbee1.puts("ATCN\n"); 00055 wait(2); 00056 xbee1.puts("sending to xbee with adress 409F7454"); 00057 myled = 0; 00058 //*/ 00059 while(1) { 00060 if (mybutton == 0) { //if button pressed 00061 sendsignal(); 00062 } 00063 00064 } 00065 } 00066 00067 void sendsignal() 00068 { 00069 if(counter == 0) { 00070 xbee1.putc(65); //XBee write 00071 counter++; 00072 } 00073 else if (counter == 1) { 00074 xbee1.puts("PINDA LIEP LANGS SPOORWEGBAAN! DAAR KWAM JUIST EEN TREINTJE AAN! PINDA KON NIET WEG HELAAS! TUT! TUT! TUT! PINDAKAAAAS!!!"); 00075 counter = 0; 00076 } 00077 myled = 1; 00078 wait_ms(50); 00079 myled = 0; 00080 00081 }
Generated on Mon Jul 18 2022 23:58:11 by
1.7.2