The board can also just be used as a power supply for other things, such as https://www.youtube.com/watch?v=7fOVtT420No.
4-switch : LINGG&JANKE 87864 Tastsensor 24 V
plus : LINGG&JANKE 87875-RW
= ~18 €
Code: [Local Link Removed for Guests]
timer0 2000, myWDT ' Timmer 0 ruft Watchdog Reset auf, set a timer each 2 seconds
OPTION.WDT 7000 ' Watchdog auf 7 Sek, set the timeout at 7 seconds
Gosub Setup
' Oder :
' Ev noch was an z.B. Shelly schicken mit
' wgetasync"http://192.168.1.12/relay/0?turn=toogle"
' Ergebniss abfragen mit WGETRESULT$
OPTION.WDTRESET
wait
OPTION.WDTRESET
change_input1:
if pin(0) = 0 then return ' if the pin is low, returns back
'print "Taster 1 changed to HIGH"
print mqtt.publish("/Wandtaster1", "Taster 1") 'pause 100
' wgetasync"http://192.168.1.12/relay/0?turn=toogle"
pause 200 ' Entprellen
OPTION.WDTRESET
Return
change_input5:
if pin(5) = 0 then return ' if the pin is low, returns back
'print "Taster 4 changed to HIGH"
print mqtt.publish("/Wandtaster4", "Taster 4") 'pause 100
' wgetasync"http://192.168.1.12/relay/0?turn=toogle"
pause 200 ' Entprellen
OPTION.WDTRESET
Return
change_input3:
if pin(3) = 0 then return ' if the pin is low, returns back
'print "Taster 2 changed to HIGH"
print mqtt.publish("/Wandtaster2", "Taste 2") 'pause 100
' wgetasync"http://192.168.1.12/relay/0?turn=toogle"
pause 200 ' Entprellen
OPTION.WDTRESET
Return
change_input4:
if pin(4) = 0 then return ' if the pin is low, returns back
'print "Taster 3 changed to HIGH"
print mqtt.publish("/Wandtaster3", "Taster 3") 'pause 100
' wgetasync"http://192.168.1.12/relay/0?turn=toogle"
pause 200 ' Entprellen
OPTION.WDTRESET
Return
change_input6:
if pin(6) = 0 then return ' if the pin is low, returns back
'print "Taster 5 changed to HIGH"
print mqtt.publish("/Wandtaster5", "Taster 5") 'pause 100
' wgetasync"http://192.168.1.12/relay/0?turn=toogle"
pause 200 ' Entprellen
OPTION.WDTRESET
Return
change_input7:
if pin(7) = 0 then return ' if the pin is low, returns back
'print "Taster 6 changed to HIGH"
print mqtt.publish("/Wandtaster6", "Taster 6") 'pause 100
' wgetasync"http://192.168.1.12/relay/0?turn=toogle"
pause 200 ' Entprellen
OPTION.WDTRESET
Return
change_input10:
if pin(10) = 0 then return ' if the pin is low, returns back
'print "Taster 7 changed to HIGH"
print mqtt.publish("/Wandtaster7", "Taster 7") 'pause 100
' wgetasync"http://192.168.1.12/relay/0?turn=toogle"
pause 200 ' Entprellen
OPTION.WDTRESET
Return
change_input20:
if pin(20) = 0 then return ' if the pin is low, returns back
'print "Taster 8 changed to HIGH"
print mqtt.publish("/Wandtaster8", "Taster 8") 'pause 100
' wgetasync"http://192.168.1.12/relay/0?turn=toogle"
pause 200 ' Entprellen
OPTION.WDTRESET
Return
'mqtt_msg: ' Wenn was kommt ev. reagieren, später Rückmeldung mit LED's am Taster
'OPTION.WDTRESET
'print "TOPIC : "; mqtt.topic$
'print "MESSAGE: "; mqtt.message$
'return
Setup:
'onmqtt mqtt_msg
print mqtt.setup("mqtt://192.168.121.9", 1)
print mqtt.connect("USER", "11111") ' No login / pass required
print mqtt.subscribe("/Wandtaster1") ' subscribe to the topic /AnnexTest
pin.mode 0, input, PULLUP ' set pin 12 as input
interrupt 0, change_input1 ' set interrupt on pin 0
pin.mode 5, input, PULLUP ' set pin 12 as input
interrupt 5, change_input5 ' set interrupt on pin 5
pin.mode 3, input, PULLUP ' set pin 12 as input
interrupt 3, change_input3 ' set interrupt on pin 3
pin.mode 4, input, PULLUP
interrupt 4, change_input4 ' set interrupt on pin 4
pin.mode 6, input, PULLUP
interrupt 6, change_input6 ' set interrupt on pin 6
pin.mode 7, input, PULLUP
interrupt 7, change_input7 ' set interrupt on pin 7
pin.mode 10, input, PULLUP
interrupt 10, change_input10 ' set interrupt on pin 10
pin.mode 20, input, PULLUP
interrupt 20, change_input20 ' set interrupt on pin 20
Return
myWDT:
OPTION.WDTRESET
return
end