Skip to content

Instantly share code, notes, and snippets.

@urish
Last active August 6, 2021 06:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save urish/2acbac0b7e0f127071ebdd97dc9f2e27 to your computer and use it in GitHub Desktop.
Save urish/2acbac0b7e0f127071ebdd97dc9f2e27 to your computer and use it in GitHub Desktop.
Open "MSPaint", set the foreground color to black, background color to red, and then run this script. Enjoy!
import time
import board
import digitalio
from adafruit_hid.mouse import Mouse
print("Hello!")
led = digitalio.DigitalInOut(board.LED1)
led.direction = digitalio.Direction.OUTPUT
led.value = False
mouse = Mouse()
FONT_HEIGHT = 30
FONT_WIDTH = 24
def drawH():
mouse.press(Mouse.LEFT_BUTTON)
mouse.move(y=36, x=0)
time.sleep(0.2)
mouse.release_all()
mouse.move(y=-19, x=0)
mouse.press(Mouse.LEFT_BUTTON)
time.sleep(0.2)
mouse.move(y=0, x=FONT_WIDTH)
time.sleep(0.2)
mouse.move(y=19, x=0)
time.sleep(0.2)
mouse.move(y=-FONT_HEIGHT, x=0)
time.sleep(0.2)
mouse.release_all()
mouse.move(y=4, x=12)
time.sleep(0.1)
def drawE():
mouse.press(Mouse.LEFT_BUTTON)
mouse.move(y=FONT_HEIGHT, x=0)
time.sleep(0.2)
mouse.move(y=-FONT_HEIGHT, x=0)
mouse.move(y=0, x=FONT_WIDTH)
mouse.move(y=0, x=-FONT_WIDTH)
mouse.move(y=FONT_HEIGHT//3*2, x=0)
time.sleep(0.2)
mouse.move(y=0, x=FONT_WIDTH)
mouse.move(y=0, x=-FONT_WIDTH)
mouse.move(y=FONT_HEIGHT//3*2, x=0)
time.sleep(0.2)
mouse.move(y=0, x=FONT_WIDTH)
mouse.release_all()
mouse.move(y=-FONT_HEIGHT, x=12)
time.sleep(0.1)
def drawL():
mouse.press(Mouse.LEFT_BUTTON)
mouse.move(y=FONT_HEIGHT, x=0)
time.sleep(0.2)
mouse.move(y=0, x=FONT_WIDTH)
time.sleep(0.2)
mouse.release_all()
mouse.move(y=-FONT_HEIGHT, x=12)
time.sleep(0.1)
def drawO():
mouse.press(Mouse.LEFT_BUTTON)
mouse.move(y=FONT_HEIGHT, x=0)
time.sleep(0.2)
mouse.move(y=0, x=FONT_WIDTH)
time.sleep(0.2)
mouse.move(y=-FONT_HEIGHT, x=0)
time.sleep(0.2)
mouse.move(y=0, x=-FONT_WIDTH)
time.sleep(0.2)
mouse.release_all()
mouse.move(y=0, x=FONT_WIDTH+12)
time.sleep(0.1)
def drawExcl():
mouse.press(Mouse.RIGHT_BUTTON)
mouse.move(y=28, x=0)
mouse.release(Mouse.RIGHT_BUTTON)
time.sleep(0.2)
mouse.move(y=10, x=0)
time.sleep(0.2)
mouse.press(Mouse.RIGHT_BUTTON)
mouse.move(y=4, x=0)
mouse.release_all()
time.sleep(0.2)
time.sleep(1)
led.value = False
mouse.move(y=5, x=5)
mouse.press(Mouse.LEFT_BUTTON)
time.sleep(1)
mouse.release_all()
led.value = True
drawH()
drawE()
drawL()
drawL()
drawO()
time.sleep(0.8)
drawExcl()
mouse.move(y=-30, x=15)
while True:
led.value = not led.value
time.sleep(0.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment