tbuser / nxt
- Source
- Commits
- Network (1)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Tree:
057b0dd
nxt /
| name | age | message | |
|---|---|---|---|
| |
README.rdoc | ||
| |
examples/ | ||
| |
lib/ | ||
| |
test/ |
README.rdoc
This is basically ruby-nxt. I’m simplifying things and moving it away from rubyforge.
Low-level interface for communicating directly with the NXT via a Bluetooth serial port or USB. Implements direct commands outlined in Appendix 2-LEGO MINDSTORMS NXT Direct Commands.pdf
Not all functionality is implemented yet!
For instructions on creating a bluetooth serial port connection:
- Linux: juju.org/articles/2006/10/22/bluetooth-serial-port-to-nxt-in-linux
- OSX: juju.org/articles/2006/10/22/bluetooth-serial-port-to-nxt-in-osx
- Windows: juju.org/articles/2006/08/16/ruby-serialport-nxt-on-windows
Examples
First create a new NXT object and pass the device.
@nxt = NXT.new("/dev/tty.NXT-DevB-1")
Rotate the motor connected to port B forwards indefinitely at 100% power:
@nxt.set_output_state(
NXT::MOTOR_B,
100,
NXT::MOTORON,
NXT::REGULATION_MODE_MOTOR_SPEED,
100,
NXT::MOTOR_RUN_STATE_RUNNING,
0
)
Play a tone at 1000 Hz for 500 ms:
@nxt.play_tone(1000,500)
Print out the current battery level:
puts "Battery Level: #{@nxt.get_battery_level/1000.0} V"


