
Projet Long pour AGRAL
Dependencies: mbed OneWire DHT22 TSL2561 SSD1306
Diff: main.cpp
- Revision:
- 3:e369ee47403e
- Parent:
- 2:1e52e7fab454
- Child:
- 4:2767fb09ac47
--- a/main.cpp Tue Sep 12 07:21:14 2017 +0000 +++ b/main.cpp Tue Sep 12 09:04:46 2017 +0000 @@ -1,5 +1,10 @@ #include "mbed.h" #include "OneWire.h" +#include "TSL2561.h" +#include "DHT22.h" + +TSL2561 lum_sensor( PB_7, PB_6 ); +DHT22 dht22(PA_11); OneWire owBus(PA_8); @@ -11,7 +16,8 @@ char _id[16]; DeviceAddresses* devAddresses = owBus.getFoundDevAddresses(); uint8_t foundNum = owBus.getFoundDevNum(); - printf("OneWire: found %d devices\r\n", foundNum); + + //printf("OneWire: found %d devices\r\n", foundNum); while(1) { OneWireDeviceTemperature::startConversationForAll(&owBus, OWTEMP_11_BIT); for (uint8_t i = 0; i < foundNum; i++) { @@ -21,7 +27,10 @@ continue; owDevice->generateId(_id); - printf("OneWire: device #%s = %.4f*C\r\n", _id, (float) owDevice->sendGetCommand(GET_TEMPERATURE)); + + + dht22.sample(); + printf( "Luminosity: %f \ttemp: %d \thum: %d \ttemp_sol: %f\r\n", lum_sensor.lux(),dht22.getTemperature(), dht22.getHumidity(),owDevice->sendGetCommand(GET_TEMPERATURE) ); delete owDevice; }