status 0 temperature sensor

Dependencies:   DHT DHT11 mbed

Committer:
y_xu13
Date:
Thu Jan 25 16:35:31 2018 +0000
Revision:
0:26de26537aaf
status 0 code

Who changed what in which revision?

UserRevisionLine numberNew contents of line
y_xu13 0:26de26537aaf 1 /*#include "mbed.h"
y_xu13 0:26de26537aaf 2 #include <iostream>
y_xu13 0:26de26537aaf 3 #include "Dht11.h"
y_xu13 0:26de26537aaf 4 //use namespace std;
y_xu13 0:26de26537aaf 5
y_xu13 0:26de26537aaf 6 Serial pc(USBTX, USBRX);
y_xu13 0:26de26537aaf 7 Dht11 tempSensor(PTC7);
y_xu13 0:26de26537aaf 8
y_xu13 0:26de26537aaf 9 int main(){
y_xu13 0:26de26537aaf 10 int status = tempSensor.read();
y_xu13 0:26de26537aaf 11 while(1){
y_xu13 0:26de26537aaf 12 pc.printf("Status %i, t: %i\n", status, tempSensor.getCelsius());
y_xu13 0:26de26537aaf 13 }
y_xu13 0:26de26537aaf 14 }
y_xu13 0:26de26537aaf 15 */
y_xu13 0:26de26537aaf 16 #include "mbed.h"
y_xu13 0:26de26537aaf 17 #include "Dht11.h"
y_xu13 0:26de26537aaf 18
y_xu13 0:26de26537aaf 19 Serial pc(USBTX, USBRX);
y_xu13 0:26de26537aaf 20 Dht11 sensor(PTC7);
y_xu13 0:26de26537aaf 21
y_xu13 0:26de26537aaf 22 int main() {
y_xu13 0:26de26537aaf 23 int status =sensor.read();
y_xu13 0:26de26537aaf 24 while(1){
y_xu13 0:26de26537aaf 25 pc.printf("Status %i, T: %f, H: %d\r\n", sensor.getFahrenheit(), sensor.getHumidity());
y_xu13 0:26de26537aaf 26 }
y_xu13 0:26de26537aaf 27 }