Archive for December, 2007

Talking to your Arduino, from Python, on Cygwin

It took me an hour or so of googling & trying stuff to figure this out (especially “/dev/ttyS2″), so I’ll put this here in hopes of helping future generations.

Install pyserial. Not the windows installer — download the source and then do this in cygwin:
$ python build
$ python install

Now you can connect to your Arduino from Python, inside Cygwin thus:
$ python
>>> import serial
>>> s = serial.Serial('/dev/ttyS2', baudrate=9600) # assuming COM3
>>> # use /dev/ttySn where n = COM port - 1
>>> s.writeln('hello\n')
>>> print

Here’s some Processing code to test with:

void setup() {
void loop() {
  if (Serial.available())
    Serial.print(, BYTE);