hadif azli
/
TEST123
BLYNK TEST
main.cpp@5:8a3cf73d7ed3, 2021-01-26 (annotated)
- Committer:
- kenobi
- Date:
- Tue Jan 26 08:23:29 2021 +0000
- Revision:
- 5:8a3cf73d7ed3
- Parent:
- 3:4cd9171ba989
bLYNK
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lixianyu | 0:d8f4c441e032 | 1 | #include "mbed.h" |
lixianyu | 2:6cd3b0947188 | 2 | #include "SimpleTimer.h" |
kenobi | 5:8a3cf73d7ed3 | 3 | extern Serial pc; |
lixianyu | 3:4cd9171ba989 | 4 | #include "WiFiBlynk.h" |
lixianyu | 2:6cd3b0947188 | 5 | |
kenobi | 5:8a3cf73d7ed3 | 6 | Serial pc(SERIAL_TX, SERIAL_RX); // tx, rx |
lixianyu | 2:6cd3b0947188 | 7 | Timer g_Timer; |
kenobi | 5:8a3cf73d7ed3 | 8 | DigitalOut myled(PB_3); |
lixianyu | 2:6cd3b0947188 | 9 | |
kenobi | 5:8a3cf73d7ed3 | 10 | char SSID[] = "OPPO A7"; |
kenobi | 5:8a3cf73d7ed3 | 11 | char PASS[] = "12345678"; |
lixianyu | 3:4cd9171ba989 | 12 | |
kenobi | 5:8a3cf73d7ed3 | 13 | char auth[] = "jx8SAPsgpzJ3pJPzI-q6ZhQIo1F4J7ki"; |
kenobi | 5:8a3cf73d7ed3 | 14 | |
lixianyu | 2:6cd3b0947188 | 15 | |
lixianyu | 0:d8f4c441e032 | 16 | int main() |
lixianyu | 0:d8f4c441e032 | 17 | { |
kenobi | 5:8a3cf73d7ed3 | 18 | pc.baud(9600); |
lixianyu | 3:4cd9171ba989 | 19 | pc.printf("Enter main()\r\n"); |
lixianyu | 2:6cd3b0947188 | 20 | //myled = 1; |
lixianyu | 0:d8f4c441e032 | 21 | g_Timer.start(); |
lixianyu | 2:6cd3b0947188 | 22 | SimpleTimer gSimpleTimer(g_Timer); |
lixianyu | 3:4cd9171ba989 | 23 | |
lixianyu | 3:4cd9171ba989 | 24 | EspSerial.baud(9600); |
kenobi | 5:8a3cf73d7ed3 | 25 | delay(10); |
kenobi | 5:8a3cf73d7ed3 | 26 | |
lixianyu | 3:4cd9171ba989 | 27 | Blynk.begin(auth, wifi, SSID, PASS); |
kenobi | 5:8a3cf73d7ed3 | 28 | |
lixianyu | 0:d8f4c441e032 | 29 | // Setup a function to be called every second |
kenobi | 5:8a3cf73d7ed3 | 30 | |
lixianyu | 2:6cd3b0947188 | 31 | //gSimpleTimer.setInterval(3000, PM25); |
kenobi | 5:8a3cf73d7ed3 | 32 | |
kenobi | 5:8a3cf73d7ed3 | 33 | |
lixianyu | 2:6cd3b0947188 | 34 | int pretime = g_Timer.read_ms(); |
kenobi | 5:8a3cf73d7ed3 | 35 | |
kenobi | 5:8a3cf73d7ed3 | 36 | |
lixianyu | 0:d8f4c441e032 | 37 | while(1) { |
lixianyu | 2:6cd3b0947188 | 38 | //pc.printf("Enter while(1)\r\n"); |
lixianyu | 2:6cd3b0947188 | 39 | //myled = !myled; |
lixianyu | 3:4cd9171ba989 | 40 | Blynk.run(); // All the Blynk Magic happens here... |
lixianyu | 2:6cd3b0947188 | 41 | gSimpleTimer.run(); |
kenobi | 5:8a3cf73d7ed3 | 42 | |
lixianyu | 3:4cd9171ba989 | 43 | |
lixianyu | 0:d8f4c441e032 | 44 | } |
lixianyu | 0:d8f4c441e032 | 45 | } |