|
本帖最后由 laoliu1982 于 2013-2-9 12:41 编辑
采用乐联网-arduino w5100 框架实现,具体内容参考 http://www.geek-workshop.com/thread-3381-1-1.html
观测曲线:http://open.lewei50.com/home/gatewaystatus/69
简单说明:
1 测试除夕鞭炮对颗粒物的影响,主要观察第一个曲线“小颗粒物”,使用dylos进行测试
2 测试 ppd42ns 的一致性,主要是对比第二个和第三个曲线的一致性
3 测试ppd42ns 与dylos的相关性,找出对比关系。
代码实现: - #include <LeweiClient.h>
- #include <SPI.h>
- #include <Ethernet.h>
- #include <Wire.h> //BH1750 IIC Mode
- uint8_t mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
- #define LW_USERKEY "xxxxxxxxxxxxxxxxxxxxxxx"
- #define LW_GATEWAY "01"
- //delay between updates
- #define POST_INTERVAL (10*1000)
- LeWeiClient *lwc;
- LeWeiPPDSensor the_PM1Sensor("PM1", "PM_sensor", "PM1sensor", 8);
- LeWeiPPDSensor the_PM1Sensor2("PM2", "PM_sensor", "PM1sensor", 7);
- void setup() {
- Serial.begin(9600);
- if (Ethernet.begin(mac) == 0)
- {
- Serial.print("Failed to configure Ethernet using DHCP\r\n");
- }
- else
- {
- Serial.print("Ethernet configuration OK\r\n");
- }
- // hope no exception here
- lwc = new LeWeiClient(LW_USERKEY, LW_GATEWAY);
- lwc->registerSensor(the_PM1Sensor);
- lwc->registerSensor(the_PM1Sensor2);
- }
- void loop() {
- if (lwc) {
- Serial.print("*** start data collection\r\n");
- lwc->scanDevices();
- Serial.print("*** start data send\r\n");
- lwc->send();
- /*
- * Serial.print("*** start log send\r\n");
- * lwc->sendLog("I'm alive.");
- *
- */
- //delay(POST_INTERVAL);
- }
- }
复制代码 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|