
hf
Dependencies: mbed
Fork of Proj by
Revision 1:e9b23de44bb8, committed 2016-12-05
- Comitter:
- 58340500068
- Date:
- Mon Dec 05 14:46:45 2016 +0000
- Parent:
- 0:d26b3ebaf06e
- Commit message:
- //;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sun Dec 04 23:01:44 2016 +0000 +++ b/main.cpp Mon Dec 05 14:46:45 2016 +0000 @@ -4,6 +4,7 @@ Serial pc(USBTX, USBRX); DigitalIn btn(USER_BUTTON); DigitalIn btn1(); +DigitalIn btn2(D5); Timer timer; uint8_t state_new=0; uint8_t state_menu=0; @@ -12,11 +13,56 @@ uint8_t data; int last[3] = {0,0,0}; -int lis[30] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30}; +int lis[60] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30}; +// 0-50 +void func() +{ //send 1 12 0b 00110 + int x[9]={0x06,0x40,0x00,0x00,0x00,0x00,0x13,0x10,0x14}; + int y[8]={23,12,14,16,9,4,0,0}; + int ansx[8]; + int ansy[8]; + int k = 0; + for (int j =0 ; j< 8;j++) + { ansx[j]= x[j]; + duino.putc(ansx[j]); + pc.printf("one time\n"); + wait(0.1); + } + for (int j =0 ; j< 8;j++) + { ansy[j]= y[j]; + duino.putc(ansy[j]); + pc.printf("two time\n"); + wait(0.1); + } + k++; + if(k>4){ + k=0; + } + + +} + + +void chackmape(){ // + if (timer.read() > 1) { + pc.printf("Writingccccc!\n\r"); + + duino.putc(lis[23]); + + timer.reset(); + } + if (duino.readable()) + { + pc.printf("Ponnnnnnnn!\n\r"); + + pc.printf("recieving %c\n",duino.getc()); + } + } + void Win(){ //ชนะ if (timer.read() > 1) { - pc.printf("Writing!\n\r"); + pc.printf("Writingmnm!\n\r"); duino.putc(lis[0]); duino.putc(lis[1]); duino.putc(lis[2]); @@ -160,7 +206,7 @@ Lose(); } - if (btn == 0) + if (btn == 9) { number(); @@ -189,6 +235,11 @@ { von(); } + if (btn == 0) + { + + chackmape(); + } wait(0.4);