Sunday, 5 July 2009

Arduino IDE Meets Ruby

Scripting languages have evolved a lot in the recent years. Ruby in particular, has had such a significant impact, that there are entire teams dedicated to maintaining it's visual identity across the web.

Designed by Tom Schaub is a widely used logo for the ruby programming language.

Sporting some flashy ruby icons, is the Scripting tab in the Arduino IDE. Upon startup, a listing of your ruby script files is generated from your Sketchbook directory.

Don't look, yet!

Of course there's no scripts in there, you need to crack open your ruby reference and create some. Once you do, you'll see how easy it is to automate repetitive tasks.

Hello_Arduino_World.rb code listing:
puts("Hello Arduino World")
Click RUN and you will get the standard output right to the console:

File I/O
How about writing to a file from a ruby script? Well that's easy:
myFile  ="test.txt","w")

myFile.puts("Writing a line to a text file.")
myFile.puts("And Another.")


Ruby scripting support is built into the Antipasto Arduino IDE in versions 0.8.11 or greater.



Post a Comment