Arduino Pilot.ino - v 0.1 - a script to control and read the Arduino pins from a connected computer via serial port
See the help.txt file for some.. help... list of files and how to avoid common caveats
Use the Pilot.ino sketch to control an Arduino from some scripting language, PHP class library included. Like a remote method invocation on an Arduino
PHP function set(a,b,c) -> Serial port -> Arduino -> C function doSet(a,b,c)
Original version for UDOO board by Francesco Munafò
The idea is to generically control the Arduino with some simple "Sketch Control Language" or protocol,
much like an SQL query controls (reads/writes) a database.
Standard commands are limited but we may slowly add commands when needed, to cover all possible interactions.
To add commands modify interpretCommand() to parse your new xyz command and then add a doXyz() function with the correct params.
Available "SCL" ("Sketch Control Language") commands (you can add more to the sketch):
dir <in or out> <pin>: set input or output direction for a pin
dir i 12
dir out 10
(any string beginning with i will be for input, anything else will be output)
get <analog or digital> <pin>: get current pin value
get a A0
get d 12
(writes to serial the value returned, 0/1 for digital, 0-1023 for analog)
set <analog or digital> <pin> <value>: set pin value to <value>
set a A0 128
set a A1 0x7a
set d 10 hi
(for <value> use hi or lo, or a numeric value for analog)
Use numeric values for pins, or you can use A0-An strings for analog, will be converted to numeric
Script options at the top of the script.
Some ideas for commands to add (anything that the speed of serial port can't handle,
or that can be done better on the Arduino side), for example:
fading analogs in/out, playing tunes/notes
Some ideas for extending the script:
Add an interface to add custom commands at script startup:
setCommand("cmdword",&commandFunction,"spv"); adds command cmdword that calls function commandFunction() with string,pin,value params
Contact me at francesco [A T] esurfers d o t com