
Arduino Quick Start
StickS3 speaker related APIs and example program.
#include "M5Unified.h"
void setup() {
M5.begin();
M5.Lcd.setRotation(1);
M5.Lcd.setTextDatum(middle_center);
M5.Lcd.setTextFont(&fonts::FreeMonoBold9pt7b);
M5.Lcd.clear();
M5.Lcd.drawString("Speaker", M5.Lcd.width() / 2, M5.Lcd.height() / 2);
delay(100);
}
void loop() {
M5.Speaker.tone(7000, 100); // frequency, duration
delay(1000);
M5.Speaker.tone(4000, 200); // frequency, duration
delay(1000);
}After power-on, the device will emit two sounds at different frequencies every second.
The speaker part of StickS3 uses the Speaker_Class from the M5Unified library. For more related APIs, you can refer to the following documentation: