Closed Loop

Closed loop control makes use of the wheel encoders to give feedback on how much the wheel has turned.

The following code shows how the StudioBot can be used in closed loop mode, this means the StudioBot is counting how many times the wheel encoders allow light to shine through the encoder gaps.

import board
import time
from StudioBot import *



drivetrain.straight(100, 0.5) #100cm at 50% power
time.sleep(0.5) #give enough time to apply the brakes 1/2 second


drivetrain.turn(90, 0.1)
time.sleep(0.5)

Last updated