capstone490
/
sensor_test1
status 0 temperature sensor
Revision 0:26de26537aaf, committed 2018-01-25
- Comitter:
- y_xu13
- Date:
- Thu Jan 25 16:35:31 2018 +0000
- Commit message:
- status 0 code
Changed in this revision
diff -r 000000000000 -r 26de26537aaf DHT.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DHT.lib Thu Jan 25 16:35:31 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/Wimpie/code/DHT/#9b5b3200688f
diff -r 000000000000 -r 26de26537aaf DHT11.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DHT11.lib Thu Jan 25 16:35:31 2018 +0000 @@ -0,0 +1,1 @@ +http://os.mbed.com/users/fossum_13/code/DHT11/#5da6f6de3e42
diff -r 000000000000 -r 26de26537aaf mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Jan 25 16:35:31 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/7130f322cb7e \ No newline at end of file
diff -r 000000000000 -r 26de26537aaf tempSensor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tempSensor.cpp Thu Jan 25 16:35:31 2018 +0000 @@ -0,0 +1,27 @@ +/*#include "mbed.h" +#include <iostream> +#include "Dht11.h" +//use namespace std; + + Serial pc(USBTX, USBRX); + Dht11 tempSensor(PTC7); + +int main(){ + int status = tempSensor.read(); + while(1){ + pc.printf("Status %i, t: %i\n", status, tempSensor.getCelsius()); + } +} +*/ + #include "mbed.h" + #include "Dht11.h" + + Serial pc(USBTX, USBRX); + Dht11 sensor(PTC7); + + int main() { + int status =sensor.read(); + while(1){ + pc.printf("Status %i, T: %f, H: %d\r\n", sensor.getFahrenheit(), sensor.getHumidity()); + } + } \ No newline at end of file