code.py
1 # SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industries 2 # 3 # SPDX-License-Identifier: MIT 4 5 """CircuitPython Essentials PWM piezo simpleio example""" 6 import time 7 import board 8 import simpleio 9 10 while True: 11 for f in (262, 294, 330, 349, 392, 440, 494, 523): 12 # For the M0 boards: 13 simpleio.tone(board.A2, f, 0.25) # on for 1/4 second 14 # For the M4 boards: 15 # simpleio.tone(board.A1, f, 0.25) # on for 1/4 second 16 time.sleep(0.05) # pause between notes 17 time.sleep(0.5)