1 Attachment(s)
Arduino for OM - In progress
This is my first plug-in. I am not yet comfortable with releasing it, pending a couple others testing it out, but it should be ready in a week or two.
The plug-in allows basic operation with an Arduino. My test bed is an Arduino Uno with v0022 with firmata 2.2. I should be able to test it against an Arduino Mini at some point.
Rather than worry about Arduino users coming up with their own "sketch" to put on the Arduino, and then try to communicate with it, I chose Firmata. The protocol is loosely based on MIDI and allows the PC to tell the Arduino what to do, and receive status from the Arduino.
First: I am novice at using Visual Studio and OM plug-ins, and have learned quite a bit about it over the last 1-2 weeks (when I had free time), and this plug-in may reflect that, but I have had input from OM devs and I feel this plug-in is not that bad :bolt:
Second: What the plug-in can do:
- allows the user to specify a digital pin as Input or Output, in Settings
- allows the user to specify a label for analog inputs (such as TempIN), in Settings
- allows the user to specify com port, baud rate, and Arduino type, in Settings
- allows the user to toggle the state of any pin designated as Output, in the main screen
- shows the label and status of the pins, in the main screen
- provides OM Sensors for the digital and analog pins for other plug-ins & skins
- future: allow user to specify a label for digital pins - Done
- future: allow user to specify min and max range values for analog bar - Done
- future: use globalization for display of values that have regional differences - Done
- possible future: support multiple boards
- to do: basic documentation
- to do: new allow user to specify an pin action based on another pin value (Conditions)
A reasonably skilled Arduino programmer could also add custom code to the main loop of the Firmata sketch, download it (outside OM) and perform some autonomous tasks, but the trade-off would be that the plug-in would not know the state of any outputs (Arduino/Firmata does not report back the state of OUTPUTS). I have added code that basically remembers the last write to a digital pin that is designated OUTPUT, and report that back when a read is done.
I have a few little nagging items to take care of (such as ensuring good behaviour on sleep/resume), but the current code does work for me. I have made it to handle most versions of Arduino except Mega. Although a future version may include it.
I have not implemented PWM. I have not come up with an idea I am happy with on how to do PWM with a user interface in OM. There are as many implementations for PWM as there are users so a common interface may be difficult.
If you have ideas and dream list items, feel free to post here so I have food-for-thought. That is, other than fancy skin items as I am not a graphics designer ;)
Oh, PS: Only built against the upcoming 0.9 versions.
Cheers,
John
NOTE: the Conditions button is just a placeholder for now