Cytron Maker Pi Pico Demo

../_images/cy-mpi-pico-installed.jpg

The Cytron Maker Pi Pico carrier accepts a standard Raspberry Pi Pico and adds buttons, LEDS, speaker, audio jack, SD card slot, Grove connectors, and a WiFi module socket. It doesn’t include the Pi Pico itself.

Play Tones

This demo uses the tones.py module from Music and Rhythm Examples - CircuitPython to generate musical tones on the buzzer. To try it, please copy the tones.py file to the top level of the CIRCUITPY drive, then copy the code below into code.py on CIRCUITPY.

 1# play_tones.py
 2
 3# Demo for the Cytron Maker Pi Pico with Raspberry Pi Pico installed.
 4# Play a melody on the buzzer.
 5
 6# This uses the tones module from the music/ folder of the course sample code.
 7# The tones.py file should be copied to the top level of the CIRCUITPY drive.
 8
 9import board
10import time
11
12# load the speaker driver module
13import tones
14
15#---------------------------------------------------------------
16# create an I/O object for the buzzer on GP18
17speaker = tones.ToneSpeaker(board.GP18)
18
19#---------------------------------------------------------------
20# run forever
21while True:
22    # play a major C scale up and down
23    for note in [60, 62, 64, 65, 67, 69, 71, 72, 71, 69, 67, 65, 64, 62, 60]:
24        speaker.midi_tone(note)
25        time.sleep(0.125)
26
27    speaker.noTone()
28    time.sleep(2.0)