Thanks for watching my Raspberry Pi tutorial! With your own code you can automate tasks, build auto-clickers and much more. If you liked this video please consider subscribing to see more videos like this one.
Here's the code:
(The code underneath will only function on windows)
import time
import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
kbd = Keyboard(usb_hid.devices)
layout = KeyboardLayoutUS(kbd)
time.sleep(2)
Open Run dialog
kbd.press(Keycode.WINDOWS, Keycode.R)
kbd.release_all()
time.sleep(0.5)
Launch Edge with YouTube link
layout.write('msedge.exe • Rick Astley - Never Gonna Give You Up (Off... ')
time.sleep(0.5)
kbd.press(Keycode.ENTER)
Fkbd.release_all()
Wait for browser and video to load
time.sleep(5)
Press 'F' to go fullscreen
kbd.press(Keycode.F)
kbd.release_all()