Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4990

Python • Re: stop loop with button press--raspberry pi and gpio

$
0
0
The code configures the GPIO as an output. You need an input.
By the way, the code could not run, because of SyntaxErrors.

Code:

GPIO.setup(18, GPIO.OUT)GPIO.output(18, 0) #BUTTON BLUEGPIO.setup(18, , pull_up_down=GPIO.PUD_DOWN) # invalid syntax, two commas
Instead, use GPIO.IN.

You can also configure more than one GPIO, if you put the integers into a list or tuple and us this instead of a single int.

Code:

GPIO.setup([12, 13, 14, 15], GPIO.OUT)

Statistics: Posted by DeaD_EyE — Thu Nov 14, 2024 9:38 am



Viewing all articles
Browse latest Browse all 4990

Trending Articles