MrPeanutcrackerful
Published

Stealth Glasses

This strange controller is called the "Stealth Glasses. " This controller is meant to activate stealth in a Unity Game I made.

IntermediateShowcase (no instructions)244
Stealth Glasses

Story

Read more

Code

Stealth Glasses Light Sensor

Python
The light sensor on the CPX detects the light levels on the glasses. If the light level goes below 6, which is the value I found works when putting on glasses, it will press the E button, which is the stealth button in the game I made.
from adafruit_circuitplayground import cp
from adafruit_hid.keyboard import Keyboard
import usb_hid
from adafruit_hid.keycode import Keycode
import time
kbd = Keyboard(usb_hid.devices)

while True:
    print("Light:", cp.light)
    print((cp.light,))
    time.sleep(0.1)
    if cp.light<=6:
        print("Stealth")
        kbd.press(Keycode.E)
    else:
        kbd.release_all()

Credits

MrPeanutcrackerful
4 projects • 0 followers
Contact

Comments

Please log in or sign up to comment.