Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.