From b13a10c5ce054dfd3e0420088b95a7c2056da48e Mon Sep 17 00:00:00 2001 From: Christian Zufferey Date: Fri, 31 Jan 2020 11:25:05 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=C3=A9=20un=20script=20pour=20Maxime=20:-)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../humidity/bolo-thingspeak/0_tst_maxime.lua | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Mesures/humidity/bolo-thingspeak/0_tst_maxime.lua diff --git a/Mesures/humidity/bolo-thingspeak/0_tst_maxime.lua b/Mesures/humidity/bolo-thingspeak/0_tst_maxime.lua new file mode 100644 index 0000000..cc0f0c9 --- /dev/null +++ b/Mesures/humidity/bolo-thingspeak/0_tst_maxime.lua @@ -0,0 +1,31 @@ +-- tests pour Maxime pour envoyer une valeur sur Thingspeak en pressant le bouton +-- ATTENTION: ce n'est pas testé +-- zf200131.1124 + + +zBTN=3 +gpio.mode(zBTN,gpio.INT) + +d=tmr.now() + +function maxime_send (a,b,c) + if b-d > 300*1000 then + ztemp1=ta valeur + zhum1= une autre valeur + thingspeak_url="http://api.thingspeak.com/update?api_key=kkk&" + zurl = thingspeak_url.."field1="..tostring(ztemp1).."&field2="..tostring(zhum1) + + http.get(zurl, nil, function(code, data) + if (code < 0) then + if verbose then print("HTTP request failed") end + if verbose then print("zuzu", code, data) end + else + if verbose then print(code, data) end + end + end) + + d=b + end +end + +gpio.trig(zBTN, "down", maxime_send)