Nefryで開発するIoTツールです
リビジョン | 783a854ac9ea2fa81995151f340286218de0f01a (tree) |
---|---|
日時 | 2017-03-17 18:41:20 |
作者 | Tomohiro Ito <tomohiro@yzdn...> |
コミッター | Tomohiro Ito |
AD変換のデータを構造体の配列に保存<SPIFFS断念
@@ -16,6 +16,12 @@ extern "C" { | ||
16 | 16 | |
17 | 17 | #define DEVICEID ESP.getChipId() |
18 | 18 | |
19 | +struct ADData | |
20 | +{ | |
21 | + int nBootedClock; | |
22 | + long nEphochTime; | |
23 | + int ADValue; | |
24 | +}; | |
19 | 25 | |
20 | 26 | const String szCommandReadBaseURL = "https://a.yamagata-u.ac.jp/amenity/network/M2M/KinomaControlRequest.aspx"; |
21 | 27 | const String FingurePrintSha1 ="A5 23 3B D5 FA 6C E9 C2 8F 30 17 8F EF F9 EA C8 C5 18 49 3F"; |
@@ -32,6 +38,8 @@ int nCounter30s = 0; | ||
32 | 38 | int ADvalue = 0; |
33 | 39 | bool bCommandReadingHttp = false; |
34 | 40 | bool bNoNTPupdated = true; |
41 | +ADData AD1[128]; | |
42 | +int nADcount=0; | |
35 | 43 | |
36 | 44 | WiFiUDP ntpUDP; |
37 | 45 | // You can specify the time server pool and the offset (in seconds, can be |
@@ -58,7 +66,13 @@ void timer1_ISR (void) { | ||
58 | 66 | Nefry.setLed(0, 0, 64); |
59 | 67 | |
60 | 68 | } |
61 | - ADvalue = analogRead(A0); | |
69 | + | |
70 | + ADvalue = analogRead(A0); | |
71 | + AD1[nADcount].nBootedClock = 0; | |
72 | + //AD1[nADcount].nEphochTime=(long)timeClient.getEpochTime(); | |
73 | + AD1[nADcount].ADValue = ADvalue; | |
74 | + | |
75 | + | |
62 | 76 | char buf[128]; |
63 | 77 | //Nefry.println(ADvalue); |
64 | 78 | //2014-10-10T13:50:40+09:00 (TIMEZONE JST) |
@@ -106,6 +120,7 @@ void loop() { | ||
106 | 120 | } |
107 | 121 | |
108 | 122 | if (nCounter1s >0) { |
123 | + | |
109 | 124 | if (WiFi.status() == WL_CONNECTED && bCommandReadingHttp == false) { |
110 | 125 | bCommandReadingHttp = true; |
111 | 126 | Nefry.setLed(0, 128, 0); |
@@ -124,7 +139,6 @@ void loop() { | ||
124 | 139 | bCommandReadingHttp = false; |
125 | 140 | Nefry.setLed(0, 0, 64); |
126 | 141 | } |
127 | - | |
128 | 142 | } |
129 | 143 | |
130 | 144 |
@@ -134,7 +148,8 @@ void loop() { | ||
134 | 148 | timeClient.update(); |
135 | 149 | setTime(timeClient.getEpochTime()); |
136 | 150 | // Nefry.println(timeClient.getFormattedTime()); |
137 | - Nefry.ndelay(100); | |
151 | + Nefry.println((String)AD1[nADcount].nBootedClock+"++"); | |
152 | + //Nefry.ndelay(100); | |
138 | 153 | Nefry.setLed(0, 0, 64); |
139 | 154 | } |
140 | 155 | } |