In the Fall 2012 semester I'll be teaching a quarter course (1/2 semester) on Physical Computing at Bryn Mawr College. As an experiment, I thought I'd explore programming an Arduino, but I'd like to start out programming interactively rather than jumping straight into embedded systems using C.
Processing is the basis for the standard method of the Arduino programming environment, and also Processing can be used to talk to an Arduino board directly. I wondered if Calico could be used in the same way.
Calico (formerly called Pyjama) is a multi-language, multi-library framework and IDE. The idea is that if you have a library that can talk to, say, the Arduino, then you write it once, drop it in a folder, and it will instantly appear as native library to all of the Calico languages, including Python, Jigsaw (a visual language inspired by Scratch), and Scheme---on Mac, Windows, and Linux.
It turns out that there is a library built for communicating with the Arduino from .NET/Mono. So this was really easy!
Here are the steps to interact with an Arduino from Calico:
This experiment should work with any of the basic Arduino boards. You'll just need an LED, the USB cable, and the Arduino board.
First, put a LED into the GND and Digital 13 pin. The short wire of the LED is negative, and will go into the GND pin hole. The long wire of the LED will go into the 13 hole.
Once that is in, you can connect your Arduino to your computer via the USB plug. This should work on Windows, Mac, and Linux. You'll need to know the associated serial port name.
Then you can interact with your Arduino from any Calico language. Here is an example of turning on the LED in Calico Python:
import Myro import Rhyduino with Rhyduino.Arduino("COM5") as arduino: arduino.Connect() pin = arduino.DigitalPins pin.SetPinMode(Rhyduino.PinMode.Output) count = 0 for t in Myro.timer(10): if count % 2 == 0: pin.SetPinValue(Rhyduino.DigitalPinValue.Low) else: pin.SetPinValue(Rhyduino.DigitalPinValue.High) count += 1 Myro.wait(1)
Now to try this from Linux and Mac... Enjoy!
It did work fine in Linux, just like in Windows. I just plugged the USB cable in, and Ubuntu added it with a serial interface as /dev/ttyACM0:
Documentation on Rhyduino project: