- The NeoPixel leds need to be initialized so we can use them later when we program the the different colors and modes. This is where the brightness of the pixels is set but we can change the value from the top of the program because we made a variable for it!
#determine brightness (Value can be between 0 and 1) pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=pixelBrightness)
- Next we initialize the buttons on the board by creating two variables, one for each button, and declaring each button as an input. One will be for moving down pitches (buttonD), one for moving up pitches (buttonU).
buttonD = DigitalInOut(board.BUTTON_A) #button a is the down button buttonD.direction = Direction.INPUT buttonD.pull = Pull.DOWN buttonU = DigitalInOut(board.BUTTON_B) # button b is the up button buttonU.direction = Direction.INPUT buttonU.pull = Pull.DOWN
- Next we initialize the speaker on the board and declare it as an output.
spkrenable = DigitalInOut(board.SPEAKER_ENABLE) spkrenable.direction = Direction.OUTPUT spkrenable.value = True
Text editor powered by tinymce.