Created
June 14, 2021 18:10
-
-
Save dglaude/ef09681965d3bb11c9fc3b2b6ad478e3 to your computer and use it in GitHub Desktop.
Tentative dynamic emoji in Discord (edit previous post and change by a different emoji every second)
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
# CircuitPython Discord rotating clock emoji (spam). | |
# Type an emoji in Discord... do nothing else, with your ItsiBitsy nrF. | |
# Press the button to replace that emoji by another one every second. | |
import time | |
import board | |
import usb_hid | |
from digitalio import DigitalInOut, Direction | |
from adafruit_hid.keyboard import Keyboard | |
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS | |
from adafruit_hid.keycode import Keycode | |
kbd = Keyboard(usb_hid.devices) | |
layout = KeyboardLayoutUS(kbd) | |
sendme = [ | |
':clock12:\n', | |
':clock1230:\n', | |
':clock1:\n', | |
':clock130:\n', | |
':clock2:\n', | |
':clock230:\n', | |
':clock3:\n', | |
':clock330:\n', | |
':clock4:\n', | |
':clock430:\n', | |
':clock5:\n', | |
':clock530:\n', | |
':clock6:\n', | |
':clock630:\n', | |
':clock7:\n', | |
':clock730:\n', | |
':clock8:\n', | |
':clock830:\n', | |
':clock9:\n', | |
':clock930:\n', | |
':clock10:\n', | |
':clock1030:\n', | |
':clock11:\n', | |
':clock1130:\n', | |
':clock12:\n',] | |
button = DigitalInOut(board.SWITCH) | |
button.direction = Direction.INPUT | |
print("press a key") | |
while True: | |
while not button.value: # wait for a click | |
time.sleep(0.01) | |
for message in sendme: | |
kbd.send(Keycode.UP_ARROW) # send up arrow | |
time.sleep(0.1) | |
kbd.send(Keycode.DELETE) # send delete | |
time.sleep(0.1) | |
kbd.send(Keycode.BACKSPACE) # send backspace | |
time.sleep(0.1) | |
layout.write(message) | |
time.sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment