Wataru Shibazaki
/
miniroboOK
minirobo OK tuusin
Revision 0:9b5fac6e0bae, committed 2020-10-09
- Comitter:
- shibazakiwataru
- Date:
- Fri Oct 09 10:38:53 2020 +0000
- Commit message:
- minirobo OK tuusin
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Oct 09 10:38:53 2020 +0000 @@ -0,0 +1,55 @@ +#include "mbed.h" +#include "string" + +RawSerial con(p28,p27,115200); +RawSerial pc (USBTX,USBRX,115200); +Ticker tras; +string tras_str = ""; +string USBtx_str = ""; + +char button; +void atras(){ + char con_c = con.getc(); + tras_str += con_c; + if(con_c == '\n'){ + USBtx_str = tras_str; + button = tras_str[0]; + tras_str = ""; + } +} +void aUSBtx(){ + //con.printf("LPCtras41\n"); + //pc.printf(USBtx_str.c_str()); + pc.printf("%d\n",int(button)); + +} +int main() +{ + tras.attach(&aUSBtx,0.5); + + con.attach(&atras,RawSerial::RxIrq); + while(1) { + if(button == 1){ + muki = 1; + speed = 100; + + saber1.putc(132); + saber1.putc(muki); + saber1.putc(speed); + saber1.putc( ( 132 + muki + speed ) & 127 ); + } + if(button == 2) { + muki = 0; + speed = 100; + + saber1.putc(132); + saber1.putc(muki); + saber1.putc(speed); + saber1.putc( ( 132 + muki + speed ) & 127 ); + } + }*/ + if(button == 8){ + pc.printf("8!!!!!!!!!!!"); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Oct 09 10:38:53 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file