Adafruit ESP32-S3 Manual page 177

Tft feather
Table of Contents

Advertisement

I2S Tone Playback
The first example generates one period of a sine wave and then loops it to generate a
tone. You can change the volume and the frequency (in Hz) of the tone by changing
the associated variables. Inside the loop, you play the tone for one second and stop it
for one second.
Update your code.py to the following.
Click the Download Project Bundle button below to download the necessary libraries
and the code.py file in a zip file. Extract the contents of the zip file, open the folder
that matches your CircuitPython version, and copy the code.py file to your CIRCUITPY
drive.
Your CIRCUITPY drive should now look similar to the following image:
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
# SPDX-License-Identifier: MIT
"""
CircuitPython I2S Tone playback example.
Plays a tone for one second on, one
second off, in a loop.
"""
import time
import array
import math
import audiocore
import board
©Adafruit Industries
Board 3V to breakout VIN
Board GND to breakout GND
Board A0 to breakout BCLK
Board A1 to breakout LRC
Board A2 to breakout DIN
Speaker + to screw terminal +
Speaker - to screw terminal -
Page 177 of 263

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP32-S3 and is the answer not in the manual?

Table of Contents

Save PDF