Skip to content

Instantly share code, notes, and snippets.

@peterhellberg
Created April 7, 2011 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterhellberg/908116 to your computer and use it in GitHub Desktop.
Save peterhellberg/908116 to your computer and use it in GitHub Desktop.
Playing with Lego Mindstorms (NXT 2.0)
require 'serialport'
require 'nxt'
# Connect to the Lego NXT
nxt = NXT.new
# Get the touch sensor
ts = TouchSensor.new(nxt)
while true
if ts.wait_for_event { ts.is_pressed? }
`say -v Boing "Button pressed"`
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment