Python Quick Reference Guide
Autonomous Motors and Drivetrain
Sample code for running a left motor with
.75 power. Should be a value of 0 to 1.
Sets up an additional encoded motor in
port 3. Runs the motor at .75 power.
Uses a sleep timer to run the motor for 5
seconds before setting power to 0.
Sets the speed of motor 1 to 60 RPM
using encoders.
Uses an encoded motor and PID control
to set speed to 60 RPM.
Use the drivetrain motors to go straight
with a speed of 10 and .5 effort.
Allows for the use of two different effort
values in the drivetrain with the motors
running for 5 seconds before stopping.
Sets the drivetrain speed to 5 RPM for 3
seconds.
Allows you to use the drivetrain to turn to
a specific degree with .5 power with
1-second sleep in between.
Python Quick Reference Guide
Sensors and Servos
Using the rangefinder, the robot will drive
while the distance is greater than 10.
Uses the reflectance sensors and PID control
to have the robot run and follow the line using
differential drive.
For a count of 10, the robot will rotate through
angles from 0 to 135
Python Quick Reference Guide
Pestolink Bluetooth Control Example
Imports the necessary modules for the
program to run.
This is where you should change the robot
name that will show up in the Bluetooth
option.
Gets the axis from the Pestolink webpage
and associates it with arcade drive using
throttle and rotation. get_axis(0) is the Y axis
and get_axis(1) is the X axis.
Sets the servo angle when button 0 is
pressed. Note there are many other button
options that could be utilized in programming.