Author Options:

Wrong end-file? Answered

The file that's attached at the end of this lesson just contains the code for the buttonLED portion, without including the photo portion. When I type in the code as it's written in the screen-grab above, it errors out with:

"input_state = GPIO.input(button)

RuntimeError: please set pin numbering mode using GPIO.setmode(GPIO.BOARD) or GPIO.setmode(GPIO.BCM)."

But the setmode function assigning BCM was was already printed earlier, so I don't understand why it's suggesting this as the solution, or what the problem might be. A final working version might be useful to try to figure out where it's failing.