hadif azli / Mbed 2 deprecated TEST123

Dependencies:   mbed Blynk

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "SimpleTimer.h"
00003 extern Serial pc;
00004 #include "WiFiBlynk.h"
00005 
00006 Serial pc(SERIAL_TX, SERIAL_RX); // tx, rx
00007 Timer g_Timer;
00008 DigitalOut myled(PB_3);
00009 
00010 char SSID[] = "OPPO A7";
00011 char PASS[] = "12345678";
00012 
00013 char auth[] = "jx8SAPsgpzJ3pJPzI-q6ZhQIo1F4J7ki";
00014 
00015 
00016 int main()
00017 {
00018     pc.baud(9600);
00019     pc.printf("Enter main()\r\n");
00020     //myled = 1;
00021     g_Timer.start();
00022     SimpleTimer gSimpleTimer(g_Timer);
00023 
00024     EspSerial.baud(9600);
00025     delay(10);
00026     
00027     Blynk.begin(auth, wifi, SSID, PASS);
00028    
00029     // Setup a function to be called every second
00030 
00031     //gSimpleTimer.setInterval(3000, PM25);
00032     
00033     
00034     int pretime = g_Timer.read_ms();
00035     
00036     
00037     while(1) {
00038         //pc.printf("Enter while(1)\r\n");
00039         //myled = !myled;
00040         Blynk.run(); // All the Blynk Magic happens here...
00041         gSimpleTimer.run();
00042         
00043 
00044     }
00045 }