von Matthias Gutjahr / @mattsches
Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It's intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments.
/* capabilities query
* -------------------------------
* 0 START_SYSEX (0xF0) (MIDI System Exclusive)
* 1 capabilities query (0x6B)
* 2 END_SYSEX (0xF7) (MIDI End of SysEx - EOX)
*/
/* capabilities response
* -------------------------------
* 0 START_SYSEX (0xF0) (MIDI System Exclusive)
* 1 capabilities response (0x6C)
* 2 1st mode supported of pin 0
* 3 1st mode's resolution of pin 0
* 4 2nd mode supported of pin 0
* 5 2nd mode's resolution of pin 0
... additional modes/resolutions, followed by a single 127 to mark the
end of the first pin's modes. Each pin follows with its mode and
127, until all pins implemented.
* N END_SYSEX (0xF7)
*/
Mindestes drei verschiedene Bibliotheken auf Basis von node.js bzw. eigener Server-Implementierungen.
https://github.com/jgautier/firmata von Julian Gautier
npm install -g firmata
var firmata = require('firmata'),
pin = 3;
var board = new firmata.Board('path to usb',function(){
//arduino is ready to communicate
});
board.digitalWrite(pin,board.HIGH);
http://breakoutjs.com/ von Jeff Hoefs
https://github.com/rwldrn/johnny-five von Rick Waldron
var five = require("../lib/johnny-five"),
// or "./lib/johnny-five" when running from the source
board = new five.Board();
board.on("ready", function() {
// Create an Led on pin 13 and strobe it on/off
// Optionally set the speed; defaults to 100ms
(new five.Led(13)).strobe(1000);
});
https://bitbucket.org/ThomasWeinert/carica-io von Thomas Weinert
include('../../src/Io/Loader.php');
Carica\Io\Loader::register();
use Carica\Io;
use Carica\Io\Firmata;
$board = new Io\Firmata\Board(
new Io\Stream\SerialPort(0)
);
$loop = Io\Event\Loop\Factory::get();
$active = $board->activate(
function ($error = NULL) use ($board, $loop) {
// ... error handling
$board->pinMode(13, Io\Firmata\PIN_STATE_OUTPUT);
$loop->add(
new Io\Event\Loop\Listener\Interval(
1000,
function () use ($board, $led) {
static $ledOn = TRUE;
$board->digitalWrite(
13, // LED PIN
$ledOn ? Io\Firmata\DIGITAL_HIGH : Io\Firmata\DIGITAL_LOW
);
$ledOn = !$ledOn;
}
)
);
}
);
if ($active) {
$loop->run();
}
@mattsches (Twitter und alles andere)