Microduino

Dependencies:   mbed

Fork of Io_moon by Li Weiyi

Files at this revision

API Documentation at this revision

Comitter:
lixianyu
Date:
Fri Jun 24 02:06:43 2016 +0000
Parent:
0:740c1eb2df13
Commit message:
?Arduino??????????0~255??????LPC824????????????????

Changed in this revision

WiFiBlynk.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
sensor.h Show annotated file Show diff for this revision Revisions of this file
--- a/WiFiBlynk.h	Thu Jun 23 11:16:14 2016 +0000
+++ b/WiFiBlynk.h	Fri Jun 24 02:06:43 2016 +0000
@@ -1,4 +1,4 @@
-
+#ifdef OPEN_BLYNK
 #include "Config.h"
 #include "ESP8266_Lib.h"
 #include "BlynkSimpleShieldEsp8266.h"
@@ -61,4 +61,5 @@
     Blynk.virtualWrite(V6, sensorPM25);
     //BLYNK_PRINT.println(sensorPM25);
 }
+#endif
 #endif
\ No newline at end of file
--- a/main.cpp	Thu Jun 23 11:16:14 2016 +0000
+++ b/main.cpp	Fri Jun 24 02:06:43 2016 +0000
@@ -51,7 +51,7 @@
 {
     static uint32_t start;
     start = g_MainTimer.read_ms();
-    pc.printf("update_oled: %u ms\r\n", start);
+    //pc.printf("update_oled: %u ms\r\n", start);
     myled = 1;
     wait_ms(60);
     myled = 0;
@@ -103,8 +103,8 @@
     wait(2.0);
 
     Blynk.begin(auth, wifi, SSID, PASS);
+    wait(3.0);
 #endif
-    wait(3.0);
     g_Ticker.detach();
 
     while(1) {
--- a/sensor.h	Thu Jun 23 11:16:14 2016 +0000
+++ b/sensor.h	Fri Jun 24 02:06:43 2016 +0000
@@ -98,9 +98,14 @@
 void updateLight(void)
 {
     uint16_t lt = gLight.read_u16();
-    lt = lt & 0x03FF;
+    pc.printf("lt0 = 0x%x, ", lt);
+    lt = lt & 0x03FF;// 10bit
+    //lt = lt >> 2;
+    //lt = (lt & 0x0FFF)>>2;
+    //lt = (lt >> 2) & 0x03FF;
     sensor_light = map(lt, 0, 1023, 0, 255);
-    //pc.printf("sensor_light=%f\r\n", sensor_light);
+    //sensor_light = map(lt, 0, 65535, 0, 65535);
+    pc.printf("lt=0x%x, sensor_light=%f\r\n", lt, sensor_light);
     sensorPM25 += 1.0;
 }
 #endif
@@ -110,8 +115,9 @@
 {
     //Sensor_etoh = map(analogRead(A2), 0, 1023, 0, 30);
     uint16_t ch4 = gCH4.read_u16();
-    ch4 = ch4 & 0x03FF;
-    Sensor_etoh = map(ch4, 0, 1023, 0, 30);
+    //ch4 = ch4 & 0x03FF;
+    //Sensor_etoh = map(ch4, 0, 1023, 0, 30);
+    Sensor_etoh = map(ch4, 0, 65535, 0, 30);
     //pc.printf("CH4 = %d\r\n", ch4);
 }