we want to make a motor on our robot have a max speed so it doesnt just shoot to fastest speed. what is the programing code. we are planning to hook it up to a pwm and use the p2_wheel to control it. thx for input.
If you want to measure the max speed in feet/s or m/s, you will need a way to measure the robot’s speed. Trial and error - use the code to assign one value to the speed controllers, and measure the actual speed. Then limit the speed controller to the closest value that you want. If you want some sort of more advanced, much more reliable, and all-around better solution, experiment with some sort of encoder - either the hall effect sensors or maybe an optical encoder to read actual speed off the drive system.
how would i limit the speed controller to the speed i want. what is the code for that.
if (yourpwm > p2_wheel) yourpwm = p2_wheel;
Watch out, because our wheels go from 64-250, they don’t actually hit 0