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.
Fork of Io_moon by
WiFiBlynk.h@0:740c1eb2df13, 2016-06-23 (annotated)
- Committer:
- lixianyu
- Date:
- Thu Jun 23 11:16:14 2016 +0000
- Revision:
- 0:740c1eb2df13
- Child:
- 1:e34100dd6532
* AM2321?????????2s????i2c?????; * SimpleTimer??bug?????????????????????????; * Blynk??bug??????????????; * ?????????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lixianyu | 0:740c1eb2df13 | 1 | |
lixianyu | 0:740c1eb2df13 | 2 | #include "Config.h" |
lixianyu | 0:740c1eb2df13 | 3 | #include "ESP8266_Lib.h" |
lixianyu | 0:740c1eb2df13 | 4 | #include "BlynkSimpleShieldEsp8266.h" |
lixianyu | 0:740c1eb2df13 | 5 | #include "SimpleTimer.h" |
lixianyu | 0:740c1eb2df13 | 6 | |
lixianyu | 0:740c1eb2df13 | 7 | Serial EspSerial(D3, D2);//tx, rx |
lixianyu | 0:740c1eb2df13 | 8 | ESP8266 wifi(EspSerial); |
lixianyu | 0:740c1eb2df13 | 9 | |
lixianyu | 0:740c1eb2df13 | 10 | void senTempHumi() |
lixianyu | 0:740c1eb2df13 | 11 | { |
lixianyu | 0:740c1eb2df13 | 12 | //pc.printf("Enter senTempHumi(),temp=%f,hum=%f\r\n",sensor_tem, sensor_hum); |
lixianyu | 0:740c1eb2df13 | 13 | Blynk.virtualWrite(V2, sensor_tem); |
lixianyu | 0:740c1eb2df13 | 14 | Blynk.virtualWrite(V3, sensor_hum); |
lixianyu | 0:740c1eb2df13 | 15 | } |
lixianyu | 0:740c1eb2df13 | 16 | |
lixianyu | 0:740c1eb2df13 | 17 | void sendLight() |
lixianyu | 0:740c1eb2df13 | 18 | { |
lixianyu | 0:740c1eb2df13 | 19 | //pc.printf("Enter sendLight(),light=%f\r\n", sensor_light); |
lixianyu | 0:740c1eb2df13 | 20 | Blynk.virtualWrite(V4, sensor_light); |
lixianyu | 0:740c1eb2df13 | 21 | } |
lixianyu | 0:740c1eb2df13 | 22 | |
lixianyu | 0:740c1eb2df13 | 23 | void sendCH4() |
lixianyu | 0:740c1eb2df13 | 24 | { |
lixianyu | 0:740c1eb2df13 | 25 | //pc.printf("Enter sendCH4(), ch4=%f\r\n", Sensor_etoh); |
lixianyu | 0:740c1eb2df13 | 26 | Blynk.virtualWrite(V5, Sensor_etoh); |
lixianyu | 0:740c1eb2df13 | 27 | } |
lixianyu | 0:740c1eb2df13 | 28 | |
lixianyu | 0:740c1eb2df13 | 29 | void sendPM25() |
lixianyu | 0:740c1eb2df13 | 30 | { |
lixianyu | 0:740c1eb2df13 | 31 | //pc.printf("Enter sendPM25(), pm25=%f\r\n", sensorPM25); |
lixianyu | 0:740c1eb2df13 | 32 | Blynk.virtualWrite(V6, sensorPM25); |
lixianyu | 0:740c1eb2df13 | 33 | } |
lixianyu | 0:740c1eb2df13 | 34 | |
lixianyu | 0:740c1eb2df13 | 35 | #if 0 |
lixianyu | 0:740c1eb2df13 | 36 | BLYNK_READ(V2) |
lixianyu | 0:740c1eb2df13 | 37 | { |
lixianyu | 0:740c1eb2df13 | 38 | Blynk.virtualWrite(V2, sensor_tem); |
lixianyu | 0:740c1eb2df13 | 39 | } |
lixianyu | 0:740c1eb2df13 | 40 | |
lixianyu | 0:740c1eb2df13 | 41 | BLYNK_READ(V3) |
lixianyu | 0:740c1eb2df13 | 42 | { |
lixianyu | 0:740c1eb2df13 | 43 | Blynk.virtualWrite(V3, sensor_hum); |
lixianyu | 0:740c1eb2df13 | 44 | } |
lixianyu | 0:740c1eb2df13 | 45 | |
lixianyu | 0:740c1eb2df13 | 46 | BLYNK_READ(V4) |
lixianyu | 0:740c1eb2df13 | 47 | { |
lixianyu | 0:740c1eb2df13 | 48 | pc.printf("Enter read V4\r\n"); |
lixianyu | 0:740c1eb2df13 | 49 | Blynk.virtualWrite(V4, sensor_light); |
lixianyu | 0:740c1eb2df13 | 50 | } |
lixianyu | 0:740c1eb2df13 | 51 | BLYNK_READ(V5) |
lixianyu | 0:740c1eb2df13 | 52 | { |
lixianyu | 0:740c1eb2df13 | 53 | pc.printf("Enter read V5\r\n"); |
lixianyu | 0:740c1eb2df13 | 54 | Blynk.virtualWrite(V5, Sensor_etoh); |
lixianyu | 0:740c1eb2df13 | 55 | //BLYNK_PRINT.println(Sensor_etoh); |
lixianyu | 0:740c1eb2df13 | 56 | } |
lixianyu | 0:740c1eb2df13 | 57 | |
lixianyu | 0:740c1eb2df13 | 58 | BLYNK_READ(V6) |
lixianyu | 0:740c1eb2df13 | 59 | { |
lixianyu | 0:740c1eb2df13 | 60 | pc.printf("Enter read V6\r\n"); |
lixianyu | 0:740c1eb2df13 | 61 | Blynk.virtualWrite(V6, sensorPM25); |
lixianyu | 0:740c1eb2df13 | 62 | //BLYNK_PRINT.println(sensorPM25); |
lixianyu | 0:740c1eb2df13 | 63 | } |
lixianyu | 0:740c1eb2df13 | 64 | #endif |