fix minor bug that happenend when encoding values

This commit is contained in:
Shannon Sterz 2016-02-28 21:36:27 +01:00
parent 46b328ca75
commit 5e2ab4326a

View file

@ -76,9 +76,9 @@ Arduino.prototype.processWriteBuffer = function () {
// Helpers
Arduino.prototype.valueToLastFour = function(val) {
var encodedVal;
var encodedVal = "";
for (var i = 3; i < 0; i--) {
for (var i = 3; i > 0; i--) {
encodedVal += String.fromCharCode(val/(Math.pow(2,8*i)));
val = val%Math.pow(2,8*i);
@ -89,9 +89,9 @@ Arduino.prototype.valueToLastFour = function(val) {
};
Arduino.prototype.valueToFirstTwo = function(val) {
var encodedVal;
var encodedVal = "";
for (var i = 1; i < 0; i--) {
for (var i = 1; i > 0; i--) {
encodedVal += String.fromCharCode(val/(Math.pow(2,8*i)));
val = val%Math.pow(2,8*i);