Node.js client for the Reflecta communications protocol for Arduino


Reflecta is a node.js client for communicating with an Arduino via the Reflecta protocol.

var Reflecta = require('./reflecta');
var reflecta = new Reflecta("COM10", function(err) {
    reflecta.on('response', function(response) { console.log(response.sequence + ' : ' + response.message); });

Sends a frame of data to the Arduino. Auto-generates a sequence number to help in detecting lost packets. Auto-calculates a simple 8 bit CRC to help detect data corruption. Auto-escapes data using SLIP escaping to turn a stream of data into deliniated frames.

Note: Be sure that portOpen event has fired before calling sendFrame. Will be sure to clean this up and simplify in future releases

An error was detected in the protocol, anything from out of sequence (dropped frame) to bad CRC or unexpected SLIP Escape (corrupted data).

A string message was received. Generally used for 'println debugging' from the Arduino.

A response was received to a function executed on the Arduino by a frame sent from this client.

A frame of data was received from the Arduino.

The communications port was closed. A light wrapper over node-serialport's close event.

The communications port was ended. A light wrapper over node-serialport's end event.

The communications port had an error. A light wrapper over node-serialport's error event.

The communications port is open. A light wrapper over node-serialport's open event.