EasyManua.ls Logo

Freenove Ultimate Starter Kit - Page 159

Freenove Ultimate Starter Kit
286 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
159
Chapter 14 Relay & Motor
█ www.freenove.com
support@freenove.com █
35
36
37
38
39
40
41
42
43
44
45
46
47
48
print("Button is released!")
GPIO.output(relayPin,relayState)
lastButtonState = reading
def destroy():
GPIO. output(relayPin, GPIO. LOW) # relay off
GPIO. cleanup() # Release resource
if __name__ == '__main__': # Program start from here
setup()
try:
loop()
e xcept KeyboardInterrupt:
destroy()
The code is in the same logic as TableLamp code above.

Table of Contents