Wataru Shibazaki
/
minirobo_honban
ue2
Revision 2:9466ab44a230, committed 2020-10-11
- Comitter:
- shibazakiwataru
- Date:
- Sun Oct 11 08:46:05 2020 +0000
- Parent:
- 1:5c8e0f148d3e
- Commit message:
- umemura_program_zyouhannsin
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 5c8e0f148d3e -r 9466ab44a230 main.cpp --- a/main.cpp Sat Oct 10 02:34:26 2020 +0000 +++ b/main.cpp Sun Oct 11 08:46:05 2020 +0000 @@ -1,6 +1,6 @@ #include "mbed.h" #include "string" -#define SPEED 30 +#define SPEED 50 RawSerial con(p28,p27,115200); RawSerial saber1(p13,p14,115200); @@ -44,41 +44,40 @@ int main() { tras.attach(&aUSBtx,0.1); - con.attach(&atras,RawSerial::RxIrq); while(1) { - if(button == 1) { - muki = 1; + if(button & 1) { + muki = 4; speed = SPEED; - saber1.putc(132); + saber1.putc(133); saber1.putc(muki); saber1.putc(speed); - saber1.putc( ( 132 + muki + speed ) & 127 ); + saber1.putc( ( 133 + muki + speed ) & 0b01111111 ); pc.printf("1!!!!!!!!!!!\n"); } - if(button == 2) { - muki = 0; + if(button & 2) { + muki = 5; speed = SPEED; - saber1.putc(132); + saber1.putc(133); saber1.putc(muki); saber1.putc(speed); - saber1.putc( ( 132 + muki + speed ) & 127 ); + saber1.putc( ( 133 + muki + speed ) & 0b01111111 ); pc.printf("2!!!!!!!!!!!\n"); } - if(button == 8) { + if(button & 8) { pc.printf("8!!!!!!!!!!!\n"); } - if(button == 4) { + if(button & 4) { Ben1 = 1; ledR = 1; //wait(0.1); pc.printf("4!!!!!!!!!!!\n"); } - if(button == 16) { + if(button & 16) { Ben2 = 1; ledG = 1; //wait(0.1);