lmclupr / brickpi-nodejs Goto Github PK
View Code? Open in Web Editor NEWBrickPi Nodejs API module
BrickPi Nodejs API module
It seems to be based on an ancient version of serialport. Can we get it updated ASAP?
On my Raspberry Pi with BrickPi, this command:
npm install brickpi-raspberry
fails:
$ npm install brickpi-raspberry
npm http GET https://registry.npmjs.org/brickpi-raspberry
npm ERR! Error: failed to fetch from registry: brickpi-raspberry
npm ERR! at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
npm ERR! at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
npm ERR! at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
npm ERR! at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
npm ERR! at Request.<anonymous> (/usr/lib/nodejs/request/main.js:212:58)
npm ERR! at Request.emit (events.js:88:20)
npm ERR! at ClientRequest.<anonymous> (/usr/lib/nodejs/request/main.js:412:12)
npm ERR! at ClientRequest.g (events.js:156:14)
npm ERR! at ClientRequest.emit (events.js:67:17)
npm ERR! at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1256:7)
npm ERR! You may report this log at:
npm ERR! <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR! reportbug --attach /home/pi/npm-debug.log npm
npm ERR!
npm ERR! System Linux 4.1.13-v7+
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "brickpi-raspberry"
npm ERR! cwd /home/pi
npm ERR! node -v v0.6.19
npm ERR! npm -v 1.1.4
npm ERR! message failed to fetch from registry: brickpi-raspberry
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/pi/npm-debug.log
npm not ok
Hey,
This 'brickpi-raspberry' node module works with older version of Brickpi kit but doesn't work with BrickPi3 because of change in communication i guess.Any solutions to make this module work with brickpi 3.Thanks
I tried setting this up on a brickpi3, and a brickpi seems to work on the brickpi but get's this error on the brickpi3
root@dpcbot03:~/jscode# node bot1.js
rx Timeout
Error: timed out
at null. (/root/node_modules/brickpi-raspberry/Brickpi.js:46:18)
at /root/node_modules/brickpi-raspberry/Driver.js:36:6
at /root/node_modules/brickpi-raspberry/node_modules/async/lib/async.js:151:21
at null._onTimeout (/root/node_modules/brickpi-raspberry/Driver.js:52:2)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
here's the code
var brickpi = require('brickpi-raspberry');
.
var robot = new brickpi.BrickPi();
var motorA = new brickpi.Motor({port: brickpi.PORTS.MA, name: 'motorA'});
var motorB = new brickpi.Motor({port: brickpi.PORTS.MB, name: 'motorB'});
.
robot.addMotor(motorA).addMotor(motorB).setup();
.
robot.on('ready', function() {
motorA.resetPosition();
motorB.resetPosition();
robot.run();
.
motorA.start(100).moveTo(5000, function(err) {
// called when motorA has reached 5000 ticks (2500 degrees in rotation).
});
});
.
setTimeout(function() {
motorB.start(50);
}, 3000);
.
setTimeout(function() {
motorB.stop();
}, 5000);
.
setTimeout(function() {
robot.stop();
}, 10000);
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.