Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any Ruby or Python interpreter for Lego Mindstorm?

Tags:

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?

like image 559
nojevive Avatar asked Jun 19 '09 11:06

nojevive


People also ask

Can you use Python with Lego Mindstorms?

You can now use your EV3 Brick to unleash the power of Python programming using MicroPython. Simply install the EV3 MicroPython image onto any micro SD card and boot up your EV3 Brick from it to start programming straight away. Switching back to the standard LEGO® MINDSTORMS® EV3 firmware is just as simple.

What programming language does Lego Mindstorms use?

An Integrated development environment targeted towards students that is used to program and control LEGO NXT, VEX, RCX and Arduino robots using a programming language based on the C programming language.

Does LEGO use Python?

Python for LEGO hubsPybricks is Python coding for smart LEGO® hubs. Run MicroPython scripts directly on the hub, and get full control of your motors and sensors.


2 Answers

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

like image 112
Louis Davis Avatar answered Oct 12 '22 23:10

Louis Davis


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.

like image 28
nosklo Avatar answered Oct 13 '22 00:10

nosklo