1b3a0906
mbutaye
Ajout des fichier...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#include "mbed.h"
#include "HumidityDevice.h"
#define ADDRESS 0x80
I2C i2c(D14, D15);
DigitalOut led1(LED1);
Serial pc(SERIAL_TX, SERIAL_RX);
int main()
{
pc.printf("starting...");
HumidityDevice humidityDevice(&pc, &i2c, true);
if(humidityDevice.find()){
humidityDevice.setup();
while(1)
{
led1 = 1;
char *data;
humidityDevice.read(data);
if(humidityDevice.hasReadTemperature()){
pc.printf("Temperature : %f\n", humidityDevice.getTemperature());
pc.printf("Humidite : %f\n", humidityDevice.getHumidity());
} else {
pc.printf("Humidite : %f\n", humidityDevice.getHumidity());
}
led1 = 0;
wait(0.5);
}
}
}
|