Skip to content

Instantly share code, notes, and snippets.

@DanielKoehler
Created March 7, 2016 15:51
Show Gist options
  • Select an option

  • Save DanielKoehler/bf123b2cd1fc138502a2 to your computer and use it in GitHub Desktop.

Select an option

Save DanielKoehler/bf123b2cd1fc138502a2 to your computer and use it in GitHub Desktop.

PyStorm functions

Start Motor

#ports: the ports that the motor(s) are plugged into
#power: 0-100 (how fast the mindstorm should go)
motor_start(ports, power)

# Example usage
# Start motors a & b with power 50
motor_start('ab', 50)

Start Motor for x Seconds

#ports: the ports that the motor(s) are plugged into
#power: 0-100 (how fast the mindstorm should go)
#time: the time in milliseconds to run the motor for
motor_time(ports, power, time)

# Example usage
# Start motors a & b with power 50 and stop after 5 seconds
motor_time('ab', 50, 5000)

Stop Motor

#ports: the ports that the motor(s) are plugged into
motor_stop(ports)

# Example usage
# stop motors a & b
motor_stop('ab')

Turn

#ports: the ports that the motor(s) are plugged into
#power: 0-100 (how fast the mindstorm should go)
#degrees: How many degrees the motor should turn
motor_degrees(ports, power, degrees)

# Example usage
# turn motor a -90 degrees 
motor_degrees('a', 50, -90)

Turn for x Seconds

Read Sensor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment