Kiyoshi Hayakawa
/
test-Xbee-serial-AT
Xbee API test program
main.cpp
- Committer:
- khayakawa
- Date:
- 2013-06-02
- Revision:
- 0:ba59a11f57b7
- Child:
- 1:0488555c7ef0
File content as of revision 0:ba59a11f57b7:
/* PC=end divce, mbed=cordinator */ /* type key on a PC connected with Xbee end device, */ /* display key on LCD of cordinator */ #include "mbed.h" #include "C12832_lcd.h" Serial pc(USBTX, USBRX); // tx, rx Serial device(p9, p10); // tx, rx C12832_LCD lcd; DigitalOut myled(LED1); char* ch[16]={"0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"}; void dev_rx () { char val; int tmp1,tmp2; myled=1; val=device.getc(); lcd.printf("%x ",val); tmp1 = val/16; tmp2 = val%16; pc.printf("%s%s",ch[tmp1],ch[tmp2]); // wait(.2); myled=0; } int main() { device.printf("Hello World!"); lcd.cls(); lcd.locate(0,0); myled=0; device.attach(&dev_rx, Serial::RxIrq); //device.attach(dev_rx, RxIrq); }