Skip to content

Instantly share code, notes, and snippets.

@zocoi
Last active February 8, 2019 00:31
Show Gist options
  • Save zocoi/7f9d49ea039d36fdcac1bde966a8f25c to your computer and use it in GitHub Desktop.
Save zocoi/7f9d49ea039d36fdcac1bde966a8f25c to your computer and use it in GitHub Desktop.
import time
import board
import touchio
import random
import adafruit_dotstar
import digitalio
touch_A3 = touchio.TouchIn(board.A3)
touch_A4 = touchio.TouchIn(board.A4)
# For Trinket M0, Gemma M0, ItsyBitsy M0 Express, and ItsyBitsy M4 Express
led = adafruit_dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1)
led.brightness = 0.3
while True:
print("started!")
time.sleep(0.1)
if touch_A3.value or touch_A4.value:
r = random.randint(0, 255)
g = random.randint(0, 255)
b = random.randint(0, 255)
led[0] = (r, g, b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment