ajout envoi lettre
This commit is contained in:
parent
33ce5e2769
commit
6949c6ab81
1 changed files with 12 additions and 1 deletions
|
@ -8,11 +8,22 @@ client:connect("student", "O99Rq8$F12NXzhL5caya")
|
|||
-- counter = nombre de cran tourner
|
||||
-- button = bouton poussoir
|
||||
|
||||
mot = ""
|
||||
last_clicked = 0
|
||||
function action(dir, counter, button)
|
||||
cls()
|
||||
lettre = string.char((counter % 26)+65)
|
||||
--if button==1 then
|
||||
if button==1 then
|
||||
if os.time() - last_clicked > 1 then
|
||||
mot = mot..lettre
|
||||
last_clicked = os.time()
|
||||
else
|
||||
client:publish("pendu/mot", mot, mqtt.QOS0)
|
||||
mot = ""
|
||||
end
|
||||
end
|
||||
console("Choix lettre : "..lettre)
|
||||
console("Mot : "..mot)
|
||||
end
|
||||
|
||||
enc = encoder.attach(pio.GPIO15, pio.GPIO2, pio.GPIO4, action)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue