hadif azli
/
TEST123
BLYNK TEST
main.cpp@0:d8f4c441e032, 2016-06-10 (annotated)
- Committer:
- lixianyu
- Date:
- Fri Jun 10 15:20:20 2016 +0000
- Revision:
- 0:d8f4c441e032
- Child:
- 1:0e75de2a5d21
u8glib???????????i2c???
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lixianyu | 0:d8f4c441e032 | 1 | #include "mbed.h" |
lixianyu | 0:d8f4c441e032 | 2 | #include "userDef.h" |
lixianyu | 0:d8f4c441e032 | 3 | #include "sensor.h" |
lixianyu | 0:d8f4c441e032 | 4 | #include "oled.h" |
lixianyu | 0:d8f4c441e032 | 5 | #include "WiFiBlynk.h" |
lixianyu | 0:d8f4c441e032 | 6 | |
lixianyu | 0:d8f4c441e032 | 7 | DigitalOut myled(P0_13); |
lixianyu | 0:d8f4c441e032 | 8 | Timer g_Timer; |
lixianyu | 0:d8f4c441e032 | 9 | |
lixianyu | 0:d8f4c441e032 | 10 | int main() |
lixianyu | 0:d8f4c441e032 | 11 | { |
lixianyu | 0:d8f4c441e032 | 12 | int ms = 0; |
lixianyu | 0:d8f4c441e032 | 13 | g_Timer.start(); |
lixianyu | 0:d8f4c441e032 | 14 | //Serial.begin(9600); // See the connection status in Serial Monitor |
lixianyu | 0:d8f4c441e032 | 15 | // Set ESP8266 baud rate |
lixianyu | 0:d8f4c441e032 | 16 | //EspSerial.begin(115200); |
lixianyu | 0:d8f4c441e032 | 17 | |
lixianyu | 0:d8f4c441e032 | 18 | //Blynk.begin(auth, wifi, SSID, PASS); |
lixianyu | 0:d8f4c441e032 | 19 | |
lixianyu | 0:d8f4c441e032 | 20 | // Setup a function to be called every second |
lixianyu | 0:d8f4c441e032 | 21 | //temHumtimer.setInterval(2000L, senTempHumi); |
lixianyu | 0:d8f4c441e032 | 22 | |
lixianyu | 0:d8f4c441e032 | 23 | wait_ms(10); |
lixianyu | 0:d8f4c441e032 | 24 | while(1) { |
lixianyu | 0:d8f4c441e032 | 25 | //Blynk.run(); // All the Blynk Magic happens here... |
lixianyu | 0:d8f4c441e032 | 26 | //temHumtimer.run(); // Initiates SimpleTimer |
lixianyu | 0:d8f4c441e032 | 27 | |
lixianyu | 0:d8f4c441e032 | 28 | updateTempHumi(); |
lixianyu | 0:d8f4c441e032 | 29 | updateLight(); |
lixianyu | 0:d8f4c441e032 | 30 | updateCH4(); |
lixianyu | 0:d8f4c441e032 | 31 | |
lixianyu | 0:d8f4c441e032 | 32 | ms = g_Timer.read_ms(); |
lixianyu | 0:d8f4c441e032 | 33 | if (pm25_time > ms) pm25_time = ms; |
lixianyu | 0:d8f4c441e032 | 34 | if (ms - pm25_time > INTERVAL_pm25) { |
lixianyu | 0:d8f4c441e032 | 35 | sensorPM25 = PM25(); |
lixianyu | 0:d8f4c441e032 | 36 | pm25_time = ms; //更新计时器 |
lixianyu | 0:d8f4c441e032 | 37 | } |
lixianyu | 0:d8f4c441e032 | 38 | |
lixianyu | 0:d8f4c441e032 | 39 | oled(sensor_tem, sensor_hum, sensor_light, sensorPM25, Sensor_etoh); |
lixianyu | 0:d8f4c441e032 | 40 | } |
lixianyu | 0:d8f4c441e032 | 41 | } |