This code receives a message from the virtual serial port and displays the message on a uLCD screen.
Dependencies: mbed 4DGL-uLCD-SE
Revision 0:e8d8f075b65c, committed 2020-04-28
- Comitter:
- jyi62
- Date:
- Tue Apr 28 04:10:36 2020 +0000
- Commit message:
- initial commit
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/4DGL-uLCD-SE.lib Tue Apr 28 04:10:36 2020 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/4180_1/code/4DGL-uLCD-SE/#2cb1845d7681
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Apr 28 04:10:36 2020 +0000 @@ -0,0 +1,33 @@ +#include "mbed.h" +#include "uLCD_4DGL.h" + +// connect mbed to Pi USB +RawSerial pi(USBTX, USBRX); +uLCD_4DGL uLCD(p28,p27,p30); // serial tx, serial rx, reset pin; + +DigitalOut led1(LED1); +DigitalOut led2(LED2); +DigitalOut led3(LED3); +DigitalOut led4(LED4); + +void dev_recv() +{ + char temp = 0; + led1 = !led1; + uLCD.cls(); + while(pi.readable()) { + temp = pi.getc(); + pi.putc(temp); + if (temp=='1') led2 = 1; + if (temp=='0') led2 = 0; + uLCD.printf("%c", temp); + } +} +int main() +{ + pi.baud(9600); + pi.attach(&dev_recv, Serial::RxIrq); + while(1) { + sleep(); + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Apr 28 04:10:36 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file