Potentiometer value: sleep

login

Potentiometer value: if/else

login
rotate_left rotate_right

play_circle stop_circle
from picozero import LED, Pot

# Set up pin numbers
led_1 = LED(13)
dial = Pot(0) 

while True:
  led_1.on()
  sleep(dial.value) # Gap between
  led_1.off()
  sleep(dial.value) # Gap between

bug_report The speed doesn't change

  • Check the LED and Pot names are consistent.
  • Check that your code is indented correctly.
rotate_left rotate_right rotate_right rotate_right rotate_left rotate_left rotate_left

play_circle stop_circle
while True:
  mood = dial.value * 100 # turn to %
  if mood < 25:
      happy() # green
  elif mood < 50:
      good() # orange
  elif mood < 75:
      okay() # pink
  else:
      unhappy() # red
  sleep(0.1)

bug_report My functions don't run

  • Make sure you have multipied your value by 100.
  • Check your function names, brackets ( ) and indentation.