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

General programming discussion • Re: little project i was thinkin about

$
0
0
Also, in your main() function you check to see if the button is pressed and if it is you print the message and turn the LED on. Now think about what is going to happen when you release the button, your code doesn't do anything if the button isn't pressed so if the LED had been turned on it will stay on on.
thats kinda the idea. when said "thing" rolls off the switch, light turns on. when said "thing" rolls back onto it and "sits" on the switch, led off.
You could just use a switch inline with the LED.

Statistics: Posted by ame — Mon Feb 05, 2024 2:44 am



Viewing all articles
Browse latest Browse all 8026

Trending Articles