NeoPixels, Buttons and Speaker set up

  • 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!
Download: file
#determine brightness (Value can be between 0 and 1)
pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=pixelBrightness)
led_pixels_image.png
The NeoPixels on the Circuit Playground Express
  • 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).
Download: file
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
led_pixels_image_U1y4tQTPTo.jpeg
The buttons on the Circuit Playground Express
  • Next we initialize the speaker on the board and declare it as an output.
Download: file
spkrenable = DigitalInOut(board.SPEAKER_ENABLE)
spkrenable.direction = Direction.OUTPUT
spkrenable.value = True 
led_pixels_image_LY6AtVCWlB.jpeg
The speaker on the Circuit Playground Express
This guide was first published on Mar 28, 2018. It was last updated on Mar 28, 2018. This page (NeoPixels, Buttons and Speaker set up) was last updated on Dec 05, 2019.