pdf-icon

Arduino Quick Start

2. Devices & Examples

6. Applications

CoreS3 Speaker

CoreS3 Speaker related APIs and case programs.

Example

cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#include "M5CoreS3.h" void setup() { auto cfg = M5.config(); CoreS3.begin(cfg); CoreS3.Display.setRotation(1); CoreS3.Display.setTextColor(GREEN); CoreS3.Display.setTextDatum(middle_center); CoreS3.Display.setTextFont(&fonts::Orbitron_Light_24); CoreS3.Display.setTextSize(1); CoreS3.Display.drawString("Speaker Test", CoreS3.Display.width() / 2, CoreS3.Display.height() / 2); } void loop() { CoreS3.Speaker.tone(10000, 100); delay(1000); CoreS3.Speaker.tone(4000, 20); delay(1000); }

API

The M5CoreS3 library is based on the M5Unified library, the Speaker part of the driver uses the Speaker_Class in the M5Unified library, for more related APIs you can refer to the following document:

On This Page