I'm trying to get an int into my variable for my GPIO pin, but I just don't know how to fit it in.
From the documentation: GPIO "channel must be an integer or list/tuple of integers"
The button_number comes in as a int from an above part code. And part of the code I'm working with looks as follows:
button1 = 27
GPIO.setup(button + button_number, GPIO.OUT)
GPIO.output(button + button_number, GPIO.LOW)
What I'm hoping to accomplish is adding the int number together with the button "pre-text" and get it recognized as the variable that's saved above.
Running this I get an error:
NameError: global name 'button' is not defined
I've also tried:
GPIO.output("button" + button_number, GPIO.LOW)
&
pin = "button" + button_number
GPIO.setup(int(pin), GPIO.OUT)
I'm running out of idea's. Please help!