RBE1001Lib
examples
MotorSpeedTest
MotorSpeedTest.ino
Go to the documentation of this file.
1
2
#include <
RBE1001Lib.h
>
3
4
LeftMotor
left_motor
;
5
LeftMotor
right_motor
;
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
}
left_motor
LeftMotor left_motor
Definition:
MotorSpeedTest.ino:4
Motor::setSpeed
void setSpeed(float newDegreesPerSecond)
Definition:
Motor.cpp:295
LeftMotor
Definition:
RBE1001Lib.h:67
RBE1001Lib.h
setup
void setup()
Definition:
MotorSpeedTest.ino:11
Motor::getEffortPercent
float getEffortPercent()
Definition:
Motor.h:265
Motor::getDegreesPerSecond
float getDegreesPerSecond()
Definition:
Motor.cpp:551
right_motor
LeftMotor right_motor
Definition:
MotorSpeedTest.ino:5
loop
void loop()
Definition:
MotorSpeedTest.ino:21
Generated by
1.8.13