BLYNK TEST

Dependencies:   mbed Blynk

main.cpp

Committer:
lixianyu
Date:
2016-06-10
Revision:
0:d8f4c441e032
Child:
1:0e75de2a5d21

File content as of revision 0:d8f4c441e032:

#include "mbed.h"
#include "userDef.h"
#include "sensor.h"
#include "oled.h"
#include "WiFiBlynk.h"

DigitalOut myled(P0_13);
Timer g_Timer;

int main()
{
    int ms = 0;
    g_Timer.start();
    //Serial.begin(9600); // See the connection status in Serial Monitor
    // Set ESP8266 baud rate
    //EspSerial.begin(115200);

    //Blynk.begin(auth, wifi, SSID, PASS);

    // Setup a function to be called every second
    //temHumtimer.setInterval(2000L, senTempHumi);

    wait_ms(10);
    while(1) {
        //Blynk.run(); // All the Blynk Magic happens here...
        //temHumtimer.run(); // Initiates SimpleTimer

        updateTempHumi();
        updateLight();
        updateCH4();

        ms = g_Timer.read_ms();
        if (pm25_time > ms) pm25_time = ms;
        if (ms - pm25_time > INTERVAL_pm25) {
            sensorPM25 = PM25();
            pm25_time = ms;    //更新计时器
        }

        oled(sensor_tem, sensor_hum, sensor_light, sensorPM25, Sensor_etoh);
    }
}