Skip to content

Speaker

tone

Syntax:

1
tone(uint16_t freq, [uint32_t duration]);

Description: Set the pitch of speaker.

Param Description type
freq frequency uint16_t
duration duration (unit: millisecond) uint16_t

Example

1
2
3
4
5
6
#include <M5Stack.h>

void setup() {
  M5.begin();
  M5.Speaker.tone(900, 1000);
}