RBE1001Lib
examples
Servo
Servo.ino
Go to the documentation of this file.
1
#include <
RBE1001Lib.h
>
2
#include <
ESP32Servo.h
>
3
#include <
ESP32AnalogRead.h
>
4
5
// https://wpiroboticsengineering.github.io/RBE1001Lib/classServo.html
6
Servo
lifter
;
7
// https://wpiroboticsengineering.github.io/RBE1001Lib/classESP32AnalogRead.html
8
ESP32AnalogRead
servoPositionFeedback
;
9
10
11
void
setup
()
12
{
13
Serial.begin(115200);
14
// pin definitions https://wpiroboticsengineering.github.io/RBE1001Lib/RBE1001Lib_8h.html#define-members
15
lifter.
attach
(
SERVO_PIN
);
16
servoPositionFeedback.
attach
(
SERVO_FEEDBACK_SENSOR
);
17
lifter.
write
(0);
18
}
19
20
/*
21
* The main loop for the program. The loop function is repeatedly called
22
* once the ESP32 is started.
23
*/
24
25
void
loop
()
26
{
27
uint16_t angle = (millis()/20) % 180;
28
lifter.
write
(angle);
29
Serial.println(angle);
30
delay(10);
31
}
Servo::write
void write(int value)
Definition:
ESP32Servo.cpp:131
servoPositionFeedback
ESP32AnalogRead servoPositionFeedback
Definition:
Servo.ino:8
SERVO_FEEDBACK_SENSOR
#define SERVO_FEEDBACK_SENSOR
Definition:
RBE1001Lib.h:32
ESP32Servo.h
RBE1001Lib.h
ESP32AnalogRead
Definition:
ESP32AnalogRead.h:7
lifter
Servo lifter
Definition:
Servo.ino:6
setup
void setup()
Definition:
Servo.ino:11
loop
void loop()
Definition:
Servo.ino:25
ESP32AnalogRead::attach
void attach(int pin)
Definition:
ESP32AnalogRead.cpp:16
ESP32AnalogRead.h
SERVO_PIN
#define SERVO_PIN
Definition:
RBE1001Lib.h:36
Servo::attach
int attach(int pin)
Definition:
ESP32Servo.cpp:73
Servo
Definition:
ESP32Servo.h:121
Generated by
1.8.13