Learn how to build a snow globe that sounds an alarm and flashes a red alert when intruders are about. Me and my six year old daughter designed and built this project to have fun with friends and learn a bit about computers along the way.
speaker play tone at 800Hz for 500ms >>> cpx.play_tone(800, 0.5) >>> # set brightness for NeoPixels to 50 percent >>> cpx.pixels.brightness = 0.5 >>> # set first NeoPixel to the color red >>> cpx.pixels[0] = [255, 0, 0] >>> # set all 10 NeoPixels to the color green >>> cpx.pixels.fill([0, 255, 0]) >>> # check if slide switch is on or off >>> cpx.switch >>> True >>> # check if capacitive touch is detected on pad A2 >>> cpx.touch_A2 >>> False
# make speaker beep >>> beep() >>> # make speaker beep at 800Hz >>> beep(800) >>> # reduce brightness to a more comfortable level >>> cpx.pixels.brightness = 0.02 >>> # set first LED to white >>> led() >>> # set second LED to red >>> led('red', 1) >>> # set 1st LED to blue with hex color code >>> led('0000ff') >>> # set 1st LED to Magenta(red on, green off, blue on) >>> led('101')