Controlling Arduinos from another application using the OSC for Arduino library
#Overview
Get and set pin values and microcontroller state with OSC using a simplified message system.
Currently, there are controller patches made for Max/MSP, and PD.
Examples for Processing, and touchOSC are coming shortly.
Features:
- Read the analog or digital value of every pin
- Write values to the pins: LOW/HIGH (0/1) and PWM (where supported)
- Enable internal pullup resistors
- Query system variables like pin count, microseconds, and power consumption
- Read Touch sensing pins on Teensy 3
- Use OSC patterns to read/write many pins simultaneously.
Everything is in stateless Call/Response style, so bundles are only received when a bundle is sent. This simplifies coding and debugging.
Commands use OSC's nested address structure:
/[ad] = analog/digital
/(number or pattern) = pin(s)
(no data) = performs an {analog,digital}Read
'u' = performs {analog,digital}Read with the pullup resistor on
(integer) = does an digitalWrite with that value
/s = system
/t = temperature (not supported by all boards)
/p = power
/d = digital pin count
/a = analog pin count
/m = microseconds (since startup)
Examples:
- "/a/0": read the value of analog pin 0
- "/d/[034] "u"": set the internal pull-up resistor on digital pins 0, 3, and 4 and return a digitalRead on those pins
- "/d/[2-5]": get the value of the digital pins 2 through 5
- "/s/m": returns the number of microseconds since the Arduino was started