improved protocol

This commit is contained in:
Shannon Sterz 2016-02-28 22:43:18 +01:00
parent 43db32eea5
commit 95a469ae4a
3 changed files with 6 additions and 6 deletions

View file

@ -119,7 +119,7 @@ void digitalR(int pin) {
pinMode(pin, INPUT); pinMode(pin, INPUT);
int digraw = digitalRead(pin); int digraw = digitalRead(pin);
Serial.print(pin); Serial.print(pin);
Serial.print('::'); Serial.print('-');
Serial.println(digraw); Serial.println(digraw);
} }
@ -143,7 +143,7 @@ void analogR(int pin) {
pinMode(pin, INPUT); pinMode(pin, INPUT);
int rval = analogRead(pin); int rval = analogRead(pin);
Serial.print(pin); Serial.print(pin);
Serial.print("::"); Serial.print('-');
Serial.println(rval); Serial.println(rval);
} }
@ -229,9 +229,9 @@ void irRead(decode_results *results) {
unsigned long codeValue = results->value; unsigned long codeValue = results->value;
int codeLen = results->bits; int codeLen = results->bits;
Serial.print(codeType); Serial.print(codeType);
Serial.print('::'); Serial.print('-');
Serial.print(codeLen); Serial.print(codeLen);
Serial.print('::'); Serial.print('-');
Serial.println(codeValue); Serial.println(codeValue);
} }
} }

View file

@ -6,7 +6,7 @@ var IR = function (arduino) {
this.arduino = arduino; this.arduino = arduino;
this.arduino.on('data', function (message) { this.arduino.on('data', function (message) {
var m = message.slice(0, -1).split('::'), var m = message.slice(0, -1).split('-'),
err = null; err = null;
if (m.length != 3) { if (m.length != 3) {

View file

@ -7,7 +7,7 @@ var Sensor = function (arduino, pin) {
this.pin = pin; this.pin = pin;
this.arduino.on('data', function (message) { this.arduino.on('data', function (message) {
var m = message.slice(0, -1).split('::'), var m = message.slice(0, -1).split('-'),
err = null; err = null;
if (m.length != 2 && this.pin != m[0]) { if (m.length != 2 && this.pin != m[0]) {