Giuseppe Guida
/
PROVA_1
Device sends a byte Coordinator reads a byte uart communication
Revision 0:094ab48dcd74, committed 2019-05-28
- Comitter:
- giuseppe_guida
- Date:
- Tue May 28 13:23:33 2019 +0000
- Commit message:
- device sends coordinator receives a byte via uart
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 094ab48dcd74 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue May 28 13:23:33 2019 +0000 @@ -0,0 +1,30 @@ +#include "mbed.h" +//#define DEVICE +#define COORDINATOR + +#ifdef COORDINATOR +Serial pc(USBTX, USBRX); +#endif + +RawSerial uart(PB_6,PB_7,9600); +int msg; + +int main() +{ + #ifdef DEVICE + int msg = 0x0F; + while(1) { + uart.putc(msg); + } + #endif + + #ifdef COORDINATOR + while(1) { + msg = uart.getc(); + wait(0.1); + pc.printf("Messaggio letto: %d\n\r",msg); + } + #endif + + +}
diff -r 000000000000 -r 094ab48dcd74 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue May 28 13:23:33 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file