Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions 12 lib/board.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var events = require('events'),
child = require('child_process'),
util = require('util'),
colors = require('colors'),
chalk = require('chalk'),
serial = require('serialport');

/*
Expand All @@ -29,7 +29,7 @@ var Board = function (options) {

self.log('info', 'binding serial events');
self.serial.on('data', function(data){
self.log('receive', data.toString().red);
self.log('receive', chalk.red(data.toString()));
self.emit('data', data);
});

Expand Down Expand Up @@ -132,7 +132,7 @@ Board.prototype.write = function (m) {
this.log('write', m);
this.serial.write('!' + m + '.');
} else {
this.log('info', 'serial not ready, buffering message: ' + m.red);
this.log('info', 'serial not ready, buffering message: ' + chalk.red(m));
this.writeBuffer.push(m);
}
}
Expand Down Expand Up @@ -181,7 +181,7 @@ Board.prototype.pinMode = function (pin, val) {
Board.prototype.digitalWrite = function (pin, val) {
pin = this.normalizePin(pin);
val = this.normalizeVal(val);
this.log('info', 'digitalWrite to pin ' + pin + ': ' + val.green);
this.log('info', 'digitalWrite to pin ' + pin + ': ' + chalk.green(val));
this.write('01' + pin + val);
}

Expand All @@ -197,7 +197,7 @@ Board.prototype.digitalRead = function (pin) {
Board.prototype.analogWrite = function (pin, val) {
pin = this.normalizePin(pin);
val = this.normalizeVal(val);
this.log('info', 'analogWrite to pin ' + pin + ': ' + val.green);
this.log('info', 'analogWrite to pin ' + pin + ': ' + chalk.green(val));
this.write('03' + pin + val);
}
Board.prototype.analogRead = function (pin) {
Expand All @@ -220,7 +220,7 @@ Board.prototype.delay = function (ms) {
Board.prototype.log = function (/*level, message*/) {
var args = [].slice.call(arguments);
if (this.debug) {
console.log(String(+new Date()).grey + ' duino '.blue + args.shift().magenta + ' ' + args.join(', '));
console.log(chalk.gray(Date.now()) + chalk.blue(' duino ') + chalk.magenta(args.shift()) + ' ' + args.join(', '));
}
}

Expand Down
2 changes: 1 addition & 1 deletion 2 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
"dependencies": {
"serialport": "*",
"colors": "*"
"chalk": "*"
},
"devDependencies": {}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.