Encoders

Hello,
I have the basic Rover kit, and I purchased an optical encoder set (robotshop.com/en/encoder-pai … arbox.html). However I have no clue how to integrate the encoders into my current sketch to stabilize speed. Any help or links are much appreciated!
Thanks in advance!

There is some sample code for using the encoders in the DFRobotShop Rover manual. On page 32, Sketch 6 shows how to use one encoder.

If you make two copies of the part that does the sensor calculations, you can get the counts for both sensors. You then need to compare the two values to see if the robot has drifted and, if so, adjust the output PWM (or analogWrite) of the motors to make a correction.

Depending on how sophisticated you want to get, advanced algorithms use a PID controller to adjust the speed of the motors. More information about PID controllers is available here:

Hope this helps.