taka yamanouchi
/
mbed_Communication
test
Revision 0:aaf7629019a3, committed 2020-09-25
- Comitter:
- sink
- Date:
- Fri Sep 25 05:01:04 2020 +0000
- Commit message:
- test
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 |
diff -r 000000000000 -r aaf7629019a3 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Sep 25 05:01:04 2020 +0000 @@ -0,0 +1,39 @@ +#include "mbed.h" +#include "string" +#define INT_TIME 0.5 + +Ticker timer; + +DigitalOut led(LED3); + +RawSerial pc (USBTX,USBRX,115200); +RawSerial Slave (p9,p10,115200); + +string Slave_str = ""; +string pc_str = ""; + +void Slave_recv(){ + + char Slave_c = Slave.getc(); + Slave_str += Slave_c; + + if(Slave_c == '\n'){ + pc_str = Slave_str; + Slave_str = ""; + } +} + +void timer_warikomi(){ + Slave.printf("Comm_Master\n"); + pc.printf(pc_str.c_str()); + led == !led; +} + +int main(){ + + timer.attach(&timer_warikomi,INT_TIME); + + Slave.attach(&Slave_recv,RawSerial::RxIrq); + + while(true){} +} \ No newline at end of file
diff -r 000000000000 -r aaf7629019a3 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Sep 25 05:01:04 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file