TinkerBug
Demo 2: Programming an LED

Below is a program to light an LED
Select the correct options to light the LED

print("Here we go! Press CTRL+C to exit")

try:

while 1:

if GPIO.input(butPin): # button is released

pwm.ChangeDutyCycle(dc)

GPIO.output(ledPin, )

else: # button is pressed:

pwm.ChangeDutyCycle(100-dc)

GPIO.output( , GPIO.HIGH)

time.sleep(0.075)

GPIO.output(ledPin, GPIO.LOW)

.sleep(0.075)

except KeyboardInterrupt: # If CTRL+C is pressed, exit cleanly:
pwm.stop() # stop PWM
GPIO.cleanup() # cleanup all GPIO

led off
led off