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.
main.cpp
00001 #include "mbed.h" 00002 #include "XBee.h" 00003 00004 BusIn joy(p15,p12,p13,p16); 00005 DigitalIn fire(p14); 00006 DigitalOut rstxbee(p30); 00007 00008 DigitalOut myled(LED1); 00009 Serial xbee(p9, p10); 00010 Serial pc(USBTX,USBRX); 00011 //XBeeAddress64 remoteAddress = XBeeAddress64(0x0013A200, 0x40319F25); 00012 00013 unsigned int vv; 00014 unsigned char nfire,ofire; 00015 int main() { 00016 /* uint8_t Cmd[] = {'D', '4'}; 00017 uint8_t Low[] = {0x04}; 00018 uint8_t High[] = {0x05}; 00019 RemoteAtCommandRequest remoteAtRequest; 00020 */ 00021 rstxbee=0; 00022 wait(0.001); 00023 rstxbee=1; 00024 wait(1.5); 00025 /* xbee.begin(9800); 00026 00027 remoteAtRequest = RemoteAtCommandRequest(remoteAddress, Cmd, Low, sizeof(Low)); 00028 remoteAtRequest.setApplyChanges(true); 00029 */ 00030 while(1) { 00031 /* myled = 1; 00032 remoteAtRequest.setCommandValue(Low); 00033 remoteAtRequest.setCommandValueLength(sizeof(Low)); 00034 xbee.send(remoteAtRequest); 00035 myled = 0; 00036 wait(1); 00037 00038 myled = 1; 00039 remoteAtRequest.setCommandValue(High); 00040 remoteAtRequest.setCommandValueLength(sizeof(High)); 00041 xbee.send(remoteAtRequest); 00042 myled = 0; 00043 wait(1);*/ 00044 nfire = fire; 00045 wait(0.001); 00046 // pc.printf("VAL %u\t%u\n",(unsigned)nfire,(unsigned)ofire); 00047 if((ofire!=nfire)) { 00048 if(nfire==1){ 00049 xbee.printf("%u\r",vv); 00050 pc.printf("%u\r",vv); 00051 vv++; 00052 } 00053 ofire=nfire; 00054 00055 } 00056 00057 } 00058 }
Generated on Mon Jul 18 2022 22:26:30 by
1.7.2