import time
from Lights import *
from LightStrip import *
time.sleep(0.1) # Wait for USB to become ready
print("Hello, Pi Pico!")
class ColorWheel:
  """
  ...
  """
  
  def __init__(self, lightstrip, start, numleds, color):
    self._lightstrip = lightstrip
    self._start = start
    self._numleds = numleds
    self._color = color
    self._curpos = -1
  def move(self, color=None):
    """
    Move the wheel by one position
    """
    if self._curpos >= 0:    # if the current position is already defined, increase it
      self._lightstrip.setPixel(self._curpos, BLACK) # turn off the last one
      self._curpos = self._curpos + 1
      if self._curpos >= self._start + self._numleds:
        self._curpos = self._start
    else:       # if not, we start from the beginning
      self._curpos = self._start
    self._lightstrip.setPixel(self._curpos, color if color else self._color)
  def spin(self, speed=0, color=None):
    """
    Spin the wheel for ever
    """
    while True:
      self.move(color)
      time.sleep(speed)
  def setColor(self, color):
    """
    Change the default color of the wheel
    """
    self._color = color
ls = LightStrip(pin=2, name='Wheels', numleds=16,brightness=1)    
wheel1 = ColorWheel(ls, 0, 8, BLUE)
wheel2 = ColorWheel(ls, 8, 8, RED)
while True:
  wheel1.move()
  wheel2.move()
  time.sleep(0.1)