VEX IQ Python API
Intro to VEX IQ API

To program the VEX IQ controller:

  • Configure the peripherals connected to the controller in the "config" region. Create device objects in the vexiq module, passing the port number if necessary.
import sys
import vexiq
#region config
led = vexiq.TouchLed() # Touch LED on any port
bumper = vexiq.Bumper() # Switch on any port
motor = vexiq.Motor() # Motor on any port
#endregion
  • Write Python code invoking methods on peripheral objects or the main module.
led.on() # Turn the LED on
if bumper.is_pressed(): # Check whether the bumper is pressed
print "Switch is on!"
motor.run(50) # Run the motor at 50% power
sys.sleep(1) # Sleep for 1 sec
  • For details, see the full docs for the vexiq module

This API is built on top of PyMite Python interpreter, providing some (but not all) of the built-in Python functions. For full list of supported functions see the namespaces page