Skip to content

Instantly share code, notes, and snippets.

@antonvh
Created January 16, 2014 16:38
Show Gist options
  • Save antonvh/8458252 to your computer and use it in GitHub Desktop.
Save antonvh/8458252 to your computer and use it in GitHub Desktop.
Sending a motor command to mindstorms NXT using python and the jaraco library.
from jaraco.nxt import *
from jaraco.nxt.messages import *
conn = Connection('/dev/tty.NXT-DevB')
cmd = SetOutputState(
i,
motor_on=True,
set_power=motorpower,
run_state=RunState.running,
use_regulation=True, #this was the crucial part.
regulation_mode=RegulationMode.motor_speed
)
conn.send(cmds)
# clean up
conn.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment