Return to SDK Examples for Microchip Studio
32const uint16_t melody[] = {NOTE_C4, NOTE_E4, NOTE_G4, NOTE_C5,
33 NOTE_CS4, NOTE_FS4, NOTE_AS4, NOTE_CS5,
34 NOTE_E4, NOTE_G4, NOTE_C5, NOTE_E5,
35 NOTE_FS4, NOTE_AS4, NOTE_CS5, NOTE_FS5
37const uint32_t noteCount =
sizeof(melody) /
sizeof(melody[0]);
39const uint32_t toneDuration = 200;
40const int16_t toneAmplitude = INT16_MAX / 100;
43#define tonePin ConnectorIO4
47 tonePin.Mode(Connector::OUTPUT_TONE);
51 tonePin.ToneAmplitude(toneAmplitude);
55 for (uint8_t note = 0; note < noteCount; note++) {
56 tonePin.ToneContinuous(melody[note]);
void Delay_ms(uint32_t ms)
Blocks operations for ms milliseconds.
Definition SysTiming.h:287