- Download and extract the files from this repository, or clone this using
$ git clone git://github.com/aryan-02/2sensorpid.git
-
Before you import the My-Blocks, open the project properties, click "Variables" and create the following variables:
Variable Name DataType Error Numeric Integral Numeric Derivative Numeric kP Numeric kI Numeric kD Numeric l_Error Numeric - Import both the My-Blocks (init and PID).
- Right after the start block, put the init my-block.
- Now, put the PID my-block inside a loop. Add two Color Sensor blocks with mode set to Measure -> Reflected Light Intensity, set the ports for your left and right color sensors respectively. Now, plug in the left and right sensor values into their respective input slots (leftSensorValue and rightSensorValue).
- Next, Set your power, kP, kI and kD. Make sure your left motor is connected to port A and the left motor is connected to port B.
And you're done.
Fork the repository, make the changes. Make sure you commit your changes and mention what you've improved. Then make a pull request. If the changes are approved, they'll get merged into this repository.