-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from canusorn/develop
Develop
- Loading branch information
Showing
8 changed files
with
911 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+3.66 KB
(100%)
examples/01acmeter/03acmeter_iotwebconf/03acmeter_iotwebconf.ino.d1_mini.bin
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
-PMS7003- | ||
5V - VCC | ||
GND - GND | ||
D4 - TX | ||
D3 - RX(not use in this code) | ||
*/ | ||
|
||
#include <ESP8266WiFi.h> | ||
#include <PMS.h> | ||
#include <SoftwareSerial.h> | ||
#include <iotbundle.h> | ||
|
||
// 1 สร้าง object ชื่อ iot และกำหนดค่า(project) | ||
#define PROJECT "PM_METER" | ||
Iotbundle iot(PROJECT); | ||
|
||
// 1.1.ใส่ข้อมูลไวไฟ | ||
const char *ssid = "wifi_ssid"; | ||
const char *password = "wifi_pass"; | ||
|
||
// 1.2.ใส่ข้อมูล user ที่สมัครกับเว็บ iotkiddie.com | ||
String email = "[email protected]"; | ||
String pass = "12345678"; | ||
|
||
SoftwareSerial pmsSerial(D4, D3); // RX,TX | ||
PMS pms(pmsSerial); | ||
PMS::DATA data; | ||
|
||
#define PIN_RESET -1 | ||
#define DC_JUMPER 0 | ||
|
||
unsigned long previousMillis = 0, currentMillis = 0; | ||
|
||
uint8_t logo_bmp[] = { | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xC0, 0xF0, 0xE0, 0x78, 0x38, 0x78, 0x3C, 0x1C, 0x3C, 0x1C, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1C, 0x3C, 0x1C, 0x3C, 0x78, 0x38, 0xF0, 0xE0, 0xF0, 0xC0, 0xC0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x01, 0x00, 0x00, 0xF0, 0xF8, 0x70, 0x3C, 0x3C, 0x1C, 0x1E, 0x1E, 0x0E, 0x0E, 0x0E, 0x0F, 0x0F, 0x0E, 0x0E, 0x1E, 0x1E, 0x1E, 0x3C, 0x1C, 0x7C, 0x70, 0xF0, 0x70, 0x20, 0x01, 0x01, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x1C, 0x3E, 0x1E, 0x0F, 0x0F, 0x07, 0x87, 0x87, 0x07, 0x0F, 0x0F, 0x1E, 0x3E, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x1F, 0x1F, 0x3F, 0x3F, 0x1F, 0x1F, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; | ||
|
||
void setup() | ||
{ | ||
Serial.begin(115200); | ||
pmsSerial.begin(9600); | ||
|
||
WiFi.mode(WIFI_STA); | ||
WiFi.begin(ssid, password); | ||
while (WiFi.status() != WL_CONNECTED) | ||
{ | ||
delay(500); | ||
Serial.print("."); | ||
} | ||
|
||
// 2 เริ่มเชื่อมต่อ หลังจากต่อไวไฟได้ | ||
iot.begin(email, pass); | ||
} | ||
|
||
void loop() | ||
{ | ||
// 3 คอยจัดการ และส่งค่าให้เอง | ||
iot.handle(); | ||
|
||
//------get data from PMS7003------ | ||
if (pms.read(data)) | ||
{ | ||
/* 4 เมื่อได้ค่าใหม่ ให้อัพเดทตามลำดับตามตัวอย่าง | ||
ตัวไลบรารี่รวบรวมและหาค่าเฉลี่ยส่งขึ้นเว็บให้เอง | ||
ถ้าค่าไหนไม่ต้องการส่งค่า ให้กำหนดค่าเป็น NAN */ | ||
iot.update(data.PM_AE_UG_1_0, data.PM_AE_UG_2_5, data.PM_AE_UG_10_0); | ||
|
||
//------print on serial moniter------ | ||
Serial.print("PM 1.0 (ug/m3): "); | ||
Serial.println(data.PM_AE_UG_1_0); | ||
Serial.print("PM 2.5 (ug/m3): "); | ||
Serial.println(data.PM_AE_UG_2_5); | ||
Serial.print("PM 10.0 (ug/m3): "); | ||
Serial.println(data.PM_AE_UG_10_0); | ||
|
||
previousMillis = currentMillis; | ||
} | ||
} |
Oops, something went wrong.