I'm thinking there will be three things you can do:
Read a property
Write a property
Issue a command
Properties will certainly be all numbers. I can't see the need for any human-readable stuff, the host software can translate error codes, for example. I might need "boolean" values which could be represented with zero and one.
The computer and the Arduino communicate with a Serial connection. I'd like to find a Serial communications protocol that is simple and robust and I don't want to get hung up building it myself. I've looked at Firmata, SNAP, basic MIDI, Modbus, and non-standard stuff. I can't seem to find anything I'm really happy with. I suspect I will do something based on MIDI, but for now I'm going with something very simple to get things going.
A favorite Object-Oriented Programming guideline of mine is "encapsulate the concept that varies". I expect to change the implementation of the serial communication protocol so I want to "wrap" it, or hide it from the main code. This means writing a Java class and a C++ class with an interface or "API" that is designed around the requirements of the "high-level" message format I described above and handles all the back and forth to the lower level serial protocol.
No comments:
Post a Comment