import audioio import audiocore import board from drivetrain import Drivetrain from adafruit_circuitplayground import cp import time import neopixel num_pixels = 8 pixels = neopixel.NeoPixel(board.A1, num_pixels, brightness=0.3, auto_write=False) drivetrain = Drivetrain(True, True) drivetrain.set_speed(1) wavfile = "TOYSTORY.wav" f = open(wavfile, "rb") wav = audiocore.WaveFile(f) toy = audioio.AudioOut(board.A0) """ while True: drivetrain.forward() if cp.button_a: drivetrain.right() time.sleep(0.2) if cp.button_b: drivetrain.left() time.sleep(0.2) """ while True: drivetrain.forward() if not toy.playing: toy.play(wav) pixels.fill((0,0,0)) #yellow for Woody pixels.show() cp.pixels[9] = (0, 204, 0) #green cp.pixels[8] = (0, 204, 0) cp.pixels[7] = (0, 204, 0) cp.pixels[6] = (0, 204, 0) cp.pixels[5] = (0, 204, 0) cp.pixels[4] = (178, 102, 255) #purple cp.pixels[3] = (178, 102, 255) cp.pixels[2] = (178, 102, 255) cp.pixels[1] = (178, 102, 255) cp.pixels[0] = (178, 102, 255) pixels.fill((255,255,0)) #yellow for Woody pixels.show() time.sleep(2) pixels.fill((102,51,255)) #brown for woody pixels.show() time.sleep(2) pixels.fill((255,255,0)) #yellow for Woody pixels.show() time.sleep(2) pixels.fill((102,51,255)) #brown for woody pixels.show() time.sleep(2) drivetrain.right() time.sleep(4)