Created
August 10, 2024 14:32
-
-
Save 1nF0rmed/90b8f2bb6728a413eeebbda59fd12527 to your computer and use it in GitHub Desktop.
Some lightsaber stuff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import time | |
| import board | |
| import random | |
| import neopixel | |
| import digitalio | |
| from adafruit_debouncer import Button | |
| pixel_pin = board.D1 | |
| num_pixels = 144 | |
| pixels = neopixel.NeoPixel(pixel_pin, num_pixels, auto_write=False) | |
| pixels.fill((0, 0, 255)) | |
| pixels.show() | |
| pin = digitalio.DigitalInOut(board.D2) | |
| pin.direction = digitalio.Direction.INPUT | |
| pin.pull = digitalio.Pull.UP | |
| switch = Button(pin, 1000, 3000, False) | |
| while True: | |
| switch.update() | |
| if switch.pressed: | |
| print("Pressed") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment