BBC micro:bit
Bitkit - Buzzer & Neopixels
Introduction
There is nothing particularly special about the code needed to use the buzzer or Neopixels. The buzzer is connected to pin 0 and the Neopixels are on pin 1. Knowing that, you can reuse code from other projects to get the effects that you want.
Buzzer
The following code is enough to show that the buzzer works.
from microbit import * import music music.play(music.POWER_UP)
Neopixels
Here is some basic code to cycle through some colours with the four Neopixels.
from microbit import * import neopixel np = neopixel.NeoPixel(pin1, 4) # light all neopixels with given colour def light_all(col): for p in range(0, len(np)): np[p] = col np.show() red = (255,0,0) green = (0,255,0) blue = (0,0,255) yellow = (255,64,0) off = (0,0,0) cols = [red,green,blue,yellow,off] while True: for c in cols: light_all(c) sleep(1000) light_all(off) sleep(1000)