Now that we have our looping buzzer, it’s now time to add the NeoPixel to the mix to complete our police siren.
Components Needed
Little Python Brain
A tablet/phone/laptop
Steps
1
Setting up the NeoPixel
Since we’ll be using the NeoPixel, we just need to add the import neopixel and the neopixel setup blocks from the Libraries and Setup categories respectively.
2
Setting red and blue
As for setting the colors, simply drag two change color blocks and np.write() blocks. Set one to red and one to blue.
3
Combining light and sound
Since we now know that the Note and Rest Durations in the bz.playNote blocks have a sleep function (see Playing a Beep for more info), we can just combine this with the NeoPixel blocks with no added sleep() blocks!