Dotfiles, utilities, and other apparatus.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

raspi_circuitpython_blink.py 352B

123456789101112131415
  1. import time
  2. import board
  3. import digitalio
  4. print("press the button!")
  5. led = digitalio.DigitalInOut(board.D18)
  6. led.direction = digitalio.Direction.OUTPUT
  7. button = digitalio.DigitalInOut(board.D4)
  8. button.direction = digitalio.Direction.INPUT
  9. button.pull = digitalio.Pull.UP
  10. while True:
  11. led.value = not button.value # light when button is pressed!