### Wearable Ligth Display Code ###

import time
import board
from rainbowio import colorwheel
import neopixel
from digitalio import DigitalInOut, Direction, Pull
from adafruit_debouncer import Button
import adafruit_lsm6ds.lsm6ds33
import random

# Setting Up Pixels
pixel_pin = board.D12 # Set pixel pin
num_pixels = 15
pixels = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.1, auto_write=False)

# Colors
RED = (255, 0, 0)
YELLOW = (255, 150, 0)
GREEN = (0, 255, 0)
CYAN = (0, 255, 255)
BLUE = (0, 0, 255)
PURPLE = (180, 0, 255)

# Setting Up Buttons
pin1 = DigitalInOut(board.D10)
pin2 = DigitalInOut(board.D9)
pin3 = DigitalInOut(board.D6)

pin1.direction = Direction.INPUT
pin1.pull = Pull.UP
pin2.direction = Direction.INPUT
pin2.pull = Pull.UP
pin3.direction = Direction.INPUT
pin3.pull = Pull.UP

switch1 = Button(pin1)
switch2 = Button(pin2)
switch3 = Button(pin3)

# Use these to toggle through pixels, dimness, and colors based on buttons press
face = 0
lite = 0.2
colors = [RED, YELLOW, GREEN, CYAN, BLUE, PURPLE]
col = 0

# Main loop check if button is pressed toggles pixels
while True:
    switch1.update()
    switch2.update()
    switch3.update()

    if switch1.pressed:
        face += 1
        if (face>=15):
            face = 0
    if switch2.pressed:
        lite += 0.1
        if (lite>=1.0):
            lite = 0.0
    if switch3.pressed:
        col += 1
        if (col>=6):
            col = 0

    pixels.brightness = lite
    pixels.fill((0,0,0))
    pixels[face] = colors[col]
    pixels.show()