Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Playing with Lego Mindstorms (NXT 2.0)
require 'serialport'
require 'nxt'
# Connect to the Lego NXT
nxt =
# Get the touch sensor
ts =
while true
if ts.wait_for_event { ts.is_pressed? }
`say -v Boing "Button pressed"`
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.