Some example projects using sylib for various basic tasks.
Controlling a Smart Motor
void initialize() {
}
void opcontrol() {
[](double rpm){return 5;},
1,
1,
1,
1,
false,
0,
false,
0,
1,
0
);
auto motor =
sylib::Motor(17,200,
true, motor_speed_controller);
motor.set_velocity(150);
motor.stop();
motor.set_velocity_custom_controller(150);
motor.stop();
motor.set_voltage(12000);
motor.stop();
while (true){
}
}
V5 Smart Motor.
Definition: motor.hpp:206
uint32_t millis()
The current system time.
void delay(std::uint32_t delay)
Delays the current task for a set number of milliseconds.
void initialize()
Starts Sylib background processes. Called by the user in initialize()
void delay_until(std::uint32_t *const prev_time, const std::uint32_t delta)
Delays the current task until a set time.
Custom Velocity Controller.
Definition: math.hpp:743
Outputting Motor Telemetry to the PROS Terminal
void initialize() {
}
void opcontrol() {
motor.set_velocity(550);
while (true) {
printf(
"%d,%f,%f,%f,%d\n",
sylib::millis(), motor.get_velocity(), motor.get_velocity_error(), motor.get_acceleration(), motor.get_efficiency());
}
}
This output can be piped into a CSV file using the method of your choosing. With a small amount of python code, it is trivial to generate graphs from this output

Creating a Rainbow Pattern on LED Lights
void initialize() {
}
void opcontrol() {
addrled.gradient(0xFF0000, 0xFF0005, 0, 0, false, true);
addrled.cycle(*addrled, 10);
while (true) {
}
}
WS2812B Addressable LED Strip Controller.
Definition: addrled.hpp:43