Leonardo & Firmata

Of course, you could write the code to parse and execute Paul's proposed command language.

Or you could install Bitlash and have the same commands already available, and readable by humans:

print d12
a5=156
print a3

Then, when you add your ping sensor, you can add a little C code to the project to extend the language by adding the new function "ping", so you can say:

print ping()

Which is more important for your project, I wonder: the protocol, or working code?

Cheers all,

-br