RBE1001Lib
MotorSpeedTest.ino
Go to the documentation of this file.
1 
2 #include <RBE1001Lib.h>
3 
6 
7 /*
8  * This is the standard setup function that is called when the ESP32 is rebooted
9  * It is used to initialize anything that needs to be done once.
10  */
11 void setup()
12 {
13  // This will initialize the Serial as 115200 for prints
14  Serial.begin(115200);
15 }
16 
17 /*
18  * The main loop for the program. The loop function is repeatedly called
19  * once the ESP32 is started.
20  */
21 void loop()
22 {
23  float speed = 360 * sin(2 * 3.14 * (millis() % 10000) / 10000.);
24  left_motor.setSpeed(speed);
25  right_motor.setSpeed(speed);
26 
27  Serial.print("SP: ");
28  Serial.print(speed);
29  Serial.print('\t');
30 
31  Serial.print("L: ");
32  Serial.print(left_motor.getDegreesPerSecond());
33  Serial.print('\t');
34 
35  Serial.print("E: ");
36  Serial.print(left_motor.getEffortPercent());
37  Serial.print('\n');
38 
39  delay(100);
40 }
LeftMotor left_motor
void setSpeed(float newDegreesPerSecond)
Definition: Motor.cpp:295
void setup()
float getEffortPercent()
Definition: Motor.h:265
float getDegreesPerSecond()
Definition: Motor.cpp:551
LeftMotor right_motor
void loop()