Talk:Arduino Communications
Communication with Arduino Diecimila under linux is not that difficult. The instructions at arduino.cc recommend using 'screen', which actually forks a child of itself to handle responses from the board. You can do the same from the bash shell. First, start a helper program:
cat /dev/ttyUSB0 >> logfile1.raw &
When you unplug the Diecimila, ttyUSB0 goes away, causing this job to exit. You also need this because without a process holding open the connection, the Diecimila resets itself after every command.
Then send commands to the unit. Here's a sample that sends 'r a' to Simple Message System on the Diecimila to read the analog ports:
/bin/echo -e -n "r a\r" > /dev/ttyUSB0
Then get the results with this command:
tail -1 logfile1.raw
That's it! Everything else is window dressing.
As proof of concept, check out my package of shell scripts to talk to Simple Message System. Full IO & PWM control. AD is scaled to milliVolts and formatted for import to most spreadsheets. Navigate to
http://user.cavenet.com/rolandl
and download SMS1.tgz, a tar gzip'd archive file. Unpack it with:
tar xvzf SMS1.tgz
You can't (under GPLv2) remove my name and claim it as your own, but you can take it apart and re-assemble the pieces in new & interesting ways (I hope you do). Written under Kubuntu, other OSes may vary (especially Slackware!) Questions: contact rolandl@cavenet.com. I hope you find this useful. -Roland Latour