Created
July 17, 2021 16:22
-
-
Save GantMan/c48aeafea99c01f3a09b9b506a09832c to your computer and use it in GitHub Desktop.
Neopixel Trinkie April Fools Code
This file contains 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 neopixel | |
# Mouse stuff | |
import usb_hid | |
from adafruit_hid.mouse import Mouse | |
mouse = Mouse(usb_hid.devices) | |
# Annoying config | |
jump_distance = 75 # jump 75 pixels | |
delay_time = 60 # every 60 seconds | |
# Turn off LED | |
pixels = neopixel.NeoPixel(board.NEOPIXEL, 4, auto_write=True) | |
pixels.brightness = 0 | |
tracker = time.monotonic() | |
while True: | |
if time.monotonic() - tracker < delay_time: | |
continue | |
mouse.move(x=-jump_distance, y=-jump_distance) | |
# Double click | |
mouse.click(Mouse.LEFT_BUTTON) | |
mouse.click(Mouse.LEFT_BUTTON) | |
tracker = time.monotonic() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment