RBE1001Lib
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
7 // https://wpiroboticsengineering.github.io/RBE1001Lib/classESP32AnalogRead.html
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 }
void write(int value)
Definition: ESP32Servo.cpp:131
ESP32AnalogRead servoPositionFeedback
Definition: Servo.ino:8
#define SERVO_FEEDBACK_SENSOR
Definition: RBE1001Lib.h:32
Servo lifter
Definition: Servo.ino:6
void setup()
Definition: Servo.ino:11
void loop()
Definition: Servo.ino:25
void attach(int pin)
#define SERVO_PIN
Definition: RBE1001Lib.h:36
int attach(int pin)
Definition: ESP32Servo.cpp:73