Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed OneWire DHT22 TSL2561 SSD1306
Diff: main.cpp
- Revision:
- 10:fd7b1648642d
- Parent:
- 9:6ef06c9e2bab
- Child:
- 11:7c872ac9da9a
--- a/main.cpp Tue Oct 17 10:17:55 2017 +0000
+++ b/main.cpp Mon Nov 20 14:15:39 2017 +0000
@@ -35,7 +35,9 @@
DeviceAddresses* devAddresses;
uint8_t foundNum;
-void interruption()
+volatile uint8_t flag=1;
+
+void run()
{
I2C i2c(PB_7,PB_6);
@@ -51,7 +53,7 @@
owDevice->generateId(_id);
Tem_Hum_A.sample();
-
+
// Calcul sur les données envoyées par les capteurs
float Lumux = Lum.lux();
float Temp_Air = Tem_Hum_A.getTemperature()/10.0;
@@ -86,7 +88,10 @@
oled.update();
}
}
-
+void interruption(){
+ flag=1;
+ }
+
int main() {
//OneWire Tem_S
I2C i2c(PB_7,PB_6);
@@ -109,10 +114,15 @@
oled.update();
- t1.attach(interruption,60);
+ t1.attach(interruption,61);
while(1)
{
+ if(flag)
+ {
+ run();
+ flag=0;
+ }
deepsleep();
}
}
