ESP32Servo
examples
ToneExample
ToneExample.ino
Go to the documentation of this file.
1
/*
2
3
4
*/
5
6
#include <
ESP32Servo.h
>
7
int
pin
= 2;
8
void
setup
() {
9
// Allow allocation of all timers
10
ESP32PWM::allocateTimer
(0);
11
ESP32PWM::allocateTimer
(1);
12
ESP32PWM::allocateTimer
(2);
13
ESP32PWM::allocateTimer
(3);
14
Serial.begin(115200);
15
16
}
17
18
void
loop
() {
19
tone
(
pin
, 4186,
// C
20
500);
// half a second
21
tone
(
pin
, 5274,
// E
22
500);
// half a second
23
delay(500);
24
25
}
loop
void loop()
Definition:
ToneExample.ino:18
ESP32PWM::allocateTimer
static void allocateTimer(int timerNumber)
Definition:
ESP32PWM.cpp:25
ESP32Servo.h
setup
void setup()
Definition:
ToneExample.ino:8
pin
int pin
Definition:
ToneExample.ino:7
tone
void tone(int APin, unsigned int frequency)
Definition:
ESP32Tone.cpp:11
Generated by
1.8.13