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 /* PC=router divce, mbed=cordinator */ 00002 /* */ 00003 /* */ 00004 00005 #include "mbed.h" 00006 #include "C12832_lcd.h" 00007 00008 Serial pc(USBTX, USBRX); // tx, rx 00009 Serial device(p9, p10); // tx, rx 00010 C12832_LCD lcd; 00011 DigitalOut myled(LED1); 00012 DigitalIn fire(p14); 00013 00014 char* ch[16]={"0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"}; 00015 00016 void dev_rx () { 00017 char val; 00018 int tmp1,tmp2; 00019 00020 myled=1; 00021 val=device.getc(); 00022 //lcd.printf("%x ",val); 00023 tmp1 = val/16; 00024 tmp2 = val%16; 00025 pc.printf("%s%s",ch[tmp1],ch[tmp2]); 00026 //wait(.2); 00027 myled=0; 00028 00029 00030 } 00031 00032 int main() { 00033 00034 lcd.cls(); 00035 lcd.locate(0,0); 00036 myled=0; 00037 int i,tmp1,tmp2,tgl; 00038 int sd_data_on[20]={0x7E,0x00,0x10,0x17,0x01,0x00,0x13,0xA2,0x00,0x40,0x92,0xFF,0x77,0xFF,0xFE,0x02,0x44,0x32,0x05,0x70}; 00039 int sd_data_off[20]={0x7E,0x00,0x10,0x17,0x01,0x00,0x13,0xA2,0x00,0x40,0x92,0xFF,0x77,0xFF,0xFE,0x02,0x44,0x32,0x04,0x71}; 00040 00041 device.attach(&dev_rx, Serial::RxIrq); 00042 00043 tgl=0; 00044 while(1) { 00045 if (fire) { 00046 for(i=0 ; i<20 ; i++){ 00047 if(tgl==0){ 00048 device.putc(sd_data_on[i]); 00049 tmp1 = sd_data_on[i]/16; 00050 tmp2 = sd_data_on[i]%16; 00051 }else{ 00052 device.putc(sd_data_off[i]); 00053 tmp1 = sd_data_off[i]/16; 00054 tmp2 = sd_data_off[i]%16; 00055 } 00056 lcd.printf("%s%s",ch[tmp1],ch[tmp2]); 00057 pc.printf("%s%s",ch[tmp1],ch[tmp2]); 00058 } 00059 if(tgl==0) 00060 tgl=1; 00061 else 00062 tgl=0; 00063 } 00064 wait(0.2); 00065 } 00066 00067 //device.attach(dev_rx, RxIrq); 00068 00069 00070 }
Generated on Wed Jul 13 2022 03:42:17 by
