![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Serial With Mode Serial
Dependencies: DHT11 MODSERIAL mbed
Revision 0:3ca1eb9afc22, committed 2016-12-29
- Comitter:
- DSPMARCO
- Date:
- Thu Dec 29 04:18:13 2016 +0000
- Commit message:
- Serial With Mode Serial
Changed in this revision
diff -r 000000000000 -r 3ca1eb9afc22 DHT11.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DHT11.lib Thu Dec 29 04:18:13 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/fossum_13/code/DHT11/#5da6f6de3e42
diff -r 000000000000 -r 3ca1eb9afc22 MODSERIAL.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MODSERIAL.lib Thu Dec 29 04:18:13 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/Sissors/code/MODSERIAL/#4737f8a5b018
diff -r 000000000000 -r 3ca1eb9afc22 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Dec 29 04:18:13 2016 +0000 @@ -0,0 +1,69 @@ +#include "mbed.h" +#include "Dht11.h" +#include "MODSERIAL.h" +MODSERIAL usbser(USBTX, USBRX); // tx, rx +MODSERIAL devser(PTE22, PTE23); // tx, rx +//Serial usbser(USBTX, USBRX); // tx, rx +//Serial devser(PTE22, PTE23); // tx, rx +DigitalOut R(LED1); +DigitalOut G(LED2); +DigitalOut B(LED3); + +Dht11 mydht11(D9); + +int main(void) +{ + char X; + float t,h; + + usbser.baud(9600); + devser.baud(9600); + R=1; + G=1; + B=1; + + while (true) + { + mydht11.read(); // Read DHT11 sensor + t = mydht11.getCelsius(); // get Temperature in C + h = mydht11.getHumidity(); // get Humidity in % + printf("Temperature is : %0.2f C\r\n",t); + wait(0.5); + + if(usbser.readable()) + { + devser.putc(usbser.getc()); + } + + if(devser.readable()) + { + X=devser.getc(); + usbser.putc(X); + printf("\r\n"); + if(X == 'R') + { + G=1; + B=1; + R=0; + } + else if(X == 'G') + { + R=1; + B=1; + G=0; + } + else if(X == 'B') + { + R=1; + G=1; + B=0; + } + else + { + R=0; + G=0; + B=0; + } + } + } +}
diff -r 000000000000 -r 3ca1eb9afc22 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Dec 29 04:18:13 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9baf128c2fab \ No newline at end of file