diff --git a/Temp_DS18B20/temp_zf/0_cron_temp.lua b/Temp_DS18B20/temp_zf/0_cron_temp.lua
index baaad9d..b56e2a0 100644
--- a/Temp_DS18B20/temp_zf/0_cron_temp.lua
+++ b/Temp_DS18B20/temp_zf/0_cron_temp.lua
@@ -1,9 +1,19 @@
-- Petit script pour faire office de crontab pour les mesures de température
-print("\n 0_cron_temp.lua zf190727.1336 \n")
+print("\n 0_cron_temp.lua zf190728.1054 \n")
cron1=tmr.create()
cron1:alarm(10*1000, tmr.ALARM_AUTO, function()
get_temp()
end)
+ if zfield == 2 then
+ cron2=tmr.create()
+ cron2:alarm(20*1000, tmr.ALARM_AUTO, function()
+ print("cron2........................")
+ zurl=thingspeak_url.."field1="..tostring(ztemp1).."&field2="..tostring(ztemp2).."&field3="..tostring(ztemp3)
+ send_temp()
+ end)
+ end
+
+
diff --git a/Temp_DS18B20/temp_zf/0_get_temp.lua b/Temp_DS18B20/temp_zf/0_get_temp.lua
index b9812e7..2fcea1a 100644
--- a/Temp_DS18B20/temp_zf/0_get_temp.lua
+++ b/Temp_DS18B20/temp_zf/0_get_temp.lua
@@ -1,5 +1,5 @@
-- Lit le capteur de température solaire en fonction de son field qui se trouve dans les secrets !
-print("\n 0_get_temp.lua zf190617.1252 \n")
+print("\n 0_get_temp.lua zf190728.1014 \n")
-- lecture: https://thingspeak.com/channels/802784/private_show
-- source: https://nodemcu.readthedocs.io/en/master/modules/ds18b20/
@@ -13,6 +13,8 @@ function get_temp()
print(ind, temp, zfield)
if zfield == 1 then
ztemp1 = temp
+ zurl=hub_url.."field1="..tostring(ztemp1)
+ send_temp()
elseif zfield == 2 then
ztemp2 = temp
elseif zfield == 3 then
diff --git a/Temp_DS18B20/temp_zf/README.md b/Temp_DS18B20/temp_zf/README.md
index 2d0fbee..fa6f172 100644
--- a/Temp_DS18B20/temp_zf/README.md
+++ b/Temp_DS18B20/temp_zf/README.md
@@ -5,11 +5,12 @@ Petit projet pour mesurer la température intérieure et extérieure chez moi, a
On peut voir, avec ce projet assez complet, toutes les possibilités offertes de la programmation des NodeMCU en LUA, en mode événementiel.
Choses qui ne seraient pas possible si on l'avait fait en C++ (mode Arduino), comme par exemple:
-* serveur WEB service pour le HUB (API)
-* serveur WEB pour l'affichage des températures (Active Server Pages ZYX)
+* serveur WEB Active Server Pages ZYX, permet de faire des pages HTML avec du code LUA in line
+* serveur WEB service pour le HUB (API GET)
+* serveur WEB pour l'affichage des températures
+* serveur WEB pour l'IDE, modification du code source en remote directement depuis une page WEB, pas besoin d'IDE
* crontab pour les mesures de température
-* serveur WEB pour l'IDE, modification du code source en remote
-* serveur TELNET, utilisation de la console en remote
+* serveur TELNET, utilisation de la console en remote pour le debug
Toutes les fonctions sont bien séparées dans des scripts, ce qui facilite la portabilité entre les projets mais aussi sa mise au point.
@@ -48,9 +49,9 @@ node ow pcm rtctime sntp spi tmr uart wifi ws2812
Comme les mesures de températures sont faites avec 3x NodeMCU différents, il y a donc 3x fichiers de *secrets*. C'est dans ces fichiers de *secrets* qu'il y a l'information de l'adresse IP du NodeMCU qui fait office de *hub* !
```
-secrets_temp_zf_int.lua
-secrets_temp_zf_out_sud.lua
-secrets_temp_zf_out_nord.lua
+secrets_temp_int_1er.lua
+secrets_temp_out_sud.lua
+secrets_temp_out_nord.lua
```
C'est aussi là qu'il y a le *numéro du field* (zfield), c'est à dire le rôle joué par le NodeMCU_Lua:
@@ -66,7 +67,7 @@ Et c'est le **2** qui fait office de *hub*, qui concentre les mesures de tempér
On peut lire la température directement sur le NodeMCU au moyen de cet url (il faut modifier l'adresse IP du NodeMCU en question):
-nodemcu xx int, http://192.168.0.171/disp_temp.html
+nodemcu 28 int, http://192.168.0.171/disp_temp.html
nodemcu 29 sud, http://192.168.0.180/disp_temp.html
@@ -77,7 +78,7 @@ nodemcu 30 nord, http://192.168.0.105/disp_temp.html
Chaque NodeMCU a son propre serveur WEB, on peut l'accéder simplement depuis son adresse IP:
-nodemcu xx int, http://192.168.0.171
+nodemcu 28 int, http://192.168.0.171
nodemcu 29 sud, http://192.168.0.180
@@ -88,7 +89,7 @@ nodemcu 30 nord, http://192.168.0.105
Très pratique pour le debug, on peut directement modifier le code source Lua du NodeMCU en remote avec cet url:
-nodemcu xx int, http://192.168.0.171:88
+nodemcu 28 int, http://192.168.0.171:88
nodemcu 29 sud, http://192.168.0.180:88
@@ -99,7 +100,7 @@ nodemcu 30 sord, http://192.168.0.105:88
Très pratique pour le debug, on peut accéder à la console du NodeMCU en remote avec telnet:
-nodemcu xx int, **telnet -rN 192.168.0.171**
+nodemcu 28 int, **telnet -rN 192.168.0.171**
nodemcu 29 sud, **telnet -rN 192.168.0.180**
@@ -107,8 +108,11 @@ nodemcu 30 nord, **telnet -rN 192.168.0.105**
## Visualisation sur ThingSpeak
-
+La totale en détail
https://thingspeak.com/channels/817940
+Seulement la corrélation entre les trois température
+https://thingspeak.com/apps/plugins/300559
-zf190727.1447
+
+zf190728.1219
diff --git a/Temp_DS18B20/temp_zf/a5.lua b/Temp_DS18B20/temp_zf/a2.lua
similarity index 100%
rename from Temp_DS18B20/temp_zf/a5.lua
rename to Temp_DS18B20/temp_zf/a2.lua
diff --git a/Temp_DS18B20/temp_zf/a3.lua b/Temp_DS18B20/temp_zf/a3.lua
new file mode 100644
index 0000000..46e85c1
--- /dev/null
+++ b/Temp_DS18B20/temp_zf/a3.lua
@@ -0,0 +1 @@
+-- programme pour faire un test depuis de le webide
diff --git a/Temp_DS18B20/temp_zf/boot.lua b/Temp_DS18B20/temp_zf/boot.lua
index 8121b49..1172fe6 100644
--- a/Temp_DS18B20/temp_zf/boot.lua
+++ b/Temp_DS18B20/temp_zf/boot.lua
@@ -1,6 +1,6 @@
-- Scripts à charger après le boot pour démarrer son appli
-print("\n boot.lua zf190727.1341 \n")
+print("\n boot.lua zf190728.1009 \n")
function heartbeat()
f= "flash_led_xfois.lua" if file.exists(f) then dofile(f) end
@@ -13,9 +13,9 @@ function heartbeat()
end
-- charge ses propres secrets
-f= "secrets_temp_zf_int_1er.lua" if file.exists(f) then dofile(f) end
-f= "secrets_temp_zf_out_nord.lua" if file.exists(f) then dofile(f) end
-f= "secrets_temp_zf_out_sud.lua" if file.exists(f) then dofile(f) end
+f= "secrets_temp_int_1er.lua" if file.exists(f) then dofile(f) end
+f= "secrets_temp_out_nord.lua" if file.exists(f) then dofile(f) end
+f= "secrets_temp_out_sud.lua" if file.exists(f) then dofile(f) end
--f= "led_rgb.lua" if file.exists(f) then dofile(f) end
--f= "wifi_ap_start.lua" if file.exists(f) then dofile(f) end
diff --git a/Temp_DS18B20/temp_zf/img/20190601_195725.jpg b/Temp_DS18B20/temp_zf/img/20190601_195725.jpg
deleted file mode 100644
index eac04b6..0000000
Binary files a/Temp_DS18B20/temp_zf/img/20190601_195725.jpg and /dev/null differ
diff --git a/Temp_DS18B20/temp_zf/img/20190601_195730.jpg b/Temp_DS18B20/temp_zf/img/20190601_195730.jpg
deleted file mode 100644
index c893114..0000000
Binary files a/Temp_DS18B20/temp_zf/img/20190601_195730.jpg and /dev/null differ
diff --git a/Temp_DS18B20/temp_zf/img/20190601_195740.jpg b/Temp_DS18B20/temp_zf/img/20190601_195740.jpg
deleted file mode 100644
index aa29abc..0000000
Binary files a/Temp_DS18B20/temp_zf/img/20190601_195740.jpg and /dev/null differ
diff --git a/Temp_DS18B20/temp_zf/img/20190601_195747.jpg b/Temp_DS18B20/temp_zf/img/20190601_195747.jpg
deleted file mode 100644
index 96481ab..0000000
Binary files a/Temp_DS18B20/temp_zf/img/20190601_195747.jpg and /dev/null differ
diff --git a/Temp_DS18B20/temp_zf/img/20190728_122840.jpg b/Temp_DS18B20/temp_zf/img/20190728_122840.jpg
new file mode 100644
index 0000000..a8089c4
Binary files /dev/null and b/Temp_DS18B20/temp_zf/img/20190728_122840.jpg differ
diff --git a/Temp_DS18B20/temp_zf/img/20190728_122850.jpg b/Temp_DS18B20/temp_zf/img/20190728_122850.jpg
new file mode 100644
index 0000000..cb6150c
Binary files /dev/null and b/Temp_DS18B20/temp_zf/img/20190728_122850.jpg differ
diff --git a/Temp_DS18B20/temp_zf/img/Capture d’écran 2019-07-28 à 12.31.14.png b/Temp_DS18B20/temp_zf/img/Capture d’écran 2019-07-28 à 12.31.14.png
new file mode 100644
index 0000000..558a03b
Binary files /dev/null and b/Temp_DS18B20/temp_zf/img/Capture d’écran 2019-07-28 à 12.31.14.png differ
diff --git a/Temp_DS18B20/temp_zf/img/Solar_zf 2019-06-17 à 14.55.46.png b/Temp_DS18B20/temp_zf/img/Solar_zf 2019-06-17 à 14.55.46.png
deleted file mode 100644
index 77084e8..0000000
Binary files a/Temp_DS18B20/temp_zf/img/Solar_zf 2019-06-17 à 14.55.46.png and /dev/null differ
diff --git a/Temp_DS18B20/temp_zf/thingspeak.mat b/Temp_DS18B20/temp_zf/thingspeak.mat
new file mode 100644
index 0000000..6a2694d
--- /dev/null
+++ b/Temp_DS18B20/temp_zf/thingspeak.mat
@@ -0,0 +1,40 @@
+% Template MATLAB code for visualizing correlated data using the
+% SCATTER function.
+
+% zf190728.1213
+
+% Prior to running this MATLAB code template, assign the channel variables.
+% Set 'readChannelID' to the channel ID of the channel to read from.
+% Also, assign the read field IDs to the variables 'fieldID1', and 'fieldID2'.
+
+% Replace the [] with channel ID to read data from:
+readChannelID = []];
+fieldID1 = 1;
+fieldID2 = 2;
+fieldID3 = 3;
+
+% Channel Read API Key
+% If your channel is private, then enter the read API
+% Key between the '' below:
+readAPIKey = '';
+
+%% Read Data %%
+
+nbMesures = 200
+
+% Read 1 data variable
+[data1, time1] = thingSpeakRead(readChannelID, 'Field', fieldID1, 'NumPoints', nbMesures, 'ReadKey', readAPIKey);
+
+% Read 2 data variable
+[data2, time2] = thingSpeakRead(readChannelID, 'Field', fieldID2, 'NumPoints', nbMesures, 'ReadKey', readAPIKey);
+
+% Read 3 data variable
+[data3, time3] = thingSpeakRead(readChannelID, 'Field', fieldID3, 'NumPoints', nbMesures, 'ReadKey', readAPIKey);
+
+%% Visualize Data %%
+plot(time1,data1, time2,data2, time3,data3);
+
+legend({'Tint 1er','Text sud','Text nord'});
+xlabel('Time (GMT ! )');
+ylabel('Temperature °C');
+title('Mesures température 1023 Crissier');
diff --git a/Temp_DS18B20/temp_zf/web_srv2.lua b/Temp_DS18B20/temp_zf/web_srv2.lua
index 44e451a..2389b01 100644
--- a/Temp_DS18B20/temp_zf/web_srv2.lua
+++ b/Temp_DS18B20/temp_zf/web_srv2.lua
@@ -1,6 +1,6 @@
-- petit script de serveur WEB avec Active Server Page ZYX
-print("\n web_srv2.lua zf190709.2209 \n")
+print("\n web_srv2.lua zf190728.1021 \n")
ztemp=12
@@ -50,7 +50,8 @@ srv:listen(80, function(conn)
conn:on("receive", function(client, request)
_, _, method, path, vars = string.find(request, "([A-Z]+) (.+)?(.+) HTTP")
- print("request: \n---\n"..request.."---")
+ print("zrequest: \n---\n"..request.."---")
+
-- print("method: ", method) print("path: ", path) print("vars: ", vars)
if not string.find(request, "/favicon.ico") then