Is there any Ruby or Python interpreter for Lego Mindstorm?
Asked Answered
S

4

22

I want to start coding in Python or Ruby. Since I own a Lego Midstorms kit I thought it would be nice to program against it. Are there any good translators / interpeters for the Mindstorms brick?

Stereochemistry answered 19/6, 2009 at 11:15 Comment(1)
I wonder if LeJos nxj (java and relatively active) could be used with jruby lejos.sourceforge.net/forum/index.phpAmin
P
7

The nxt-python and ruby-nxt projects are remote control interfaces to the NXT. They both run on a PC and remotely control the NXT via Bluetooth or USB. If you are looking for running alternative firmware on the NXT, there are several different alternatives.

Steve Hassenplug has a webpage with a comprehensive list of all of the known alternative firmware and remote control options.
NXT Software

Provincialism answered 19/6, 2009 at 23:43 Comment(2)
Hi, thanks for the pointer to the site, I guess there's a good starting point ;-)Stereochemistry
Thanks, I know it wasn't exactly the answer you were looking for, but like you said, it is a place to start. Maybe someone will create an interpreter for python or ruby in the future. There are already projects for Java and Lua, so python and/or ruby might not be far behind. :)Provincialism
B
3

With python you can use jaraco.nxt or nxt-python to control the NXT robot. I don't own one so I've never used any of those.

Found this example using nxt-python:

#!/usr/bin/env python

import nxt.locator
from nxt.motor import Motor, PORT_B, PORT_C

def spin_around(b):
        m_left = Motor(b, PORT_B)
        m_left.update(100, 360)
        m_right = Motor(b, PORT_C)
        m_right.update(-100, 360)

sock = nxt.locator.find_one_brick()
if sock:
        spin_around(sock.connect())
        sock.close()
else:
        print 'No NXT bricks found'

Seems nice.

Bracing answered 19/6, 2009 at 11:48 Comment(1)
nojevive, if you test this, I'd appreciate some feedback on this python module.Sartain
V
1

Here's an open source project for Ruby

Virescent answered 19/6, 2009 at 11:19 Comment(0)
C
1

Try pynxc http://code.google.com/p/pynxc/

Criminate answered 11/9, 2011 at 20:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.