Tag: johnny five

如何解决使用Node.js和Johnny-Five无法find模块'serialport'?

主要目标:使用Johnny-five和node.js为我的Arduino运行脚本,使用LeapMotion Controls 我有一个文件夹 1:“robotarm.js”脚本 Leapjs'lib'文件夹 leapjs中具有下划线,glmatrix和ws的“node_modules”文件夹。 我已经上传了Arduino板上的标准Firmata,我正在尝试运行我的脚本来启动程序。 但是,当我去terminal,进入我的proj文件夹和types节点robotarm.js,这是会发生什么事情: Kriss-MacBook-Pro:armproj Kris$ node robotarm.js module.js:340 throw err; ^ Error: Cannot find module 'serialport' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:364:17) at require (module.js:380:17) at Board.Serial.detect (/Users/Kris/node_modules/johnny-five/lib/board.js:69:7) at new Board (/Users/Kris/node_modules/johnny-five/lib/board.js:299:23) at Object.<anonymous> (/Users/Kris/Desktop/armproj/robotarm.js:90:9) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32)

Firmata,Arduino和Node js之间的关系

这是一个基本的理解问题。 我试图按照这个解释http://www.barryvandam.com/node-js-communicating-with-arduino/但那里听起来有点closures给我。 据我所知,我只需要将标准的Firmata代码推入到Arduino中,并通过Node.js进行编码,以便从Arduino中调用操作和信息。 但是在这个链接中,他们指出我们需要将代码上传到Arduino,这显然会删除现在的Firmata代码。 是不是会导致失去与Arduino的连接? 它是如何工作的? 非常感谢!

如何在Ubuntu 15.04上运行johnny-five?

$ node hello.js 1436894483255 Device(s) /dev/ttyUSB0 1436894483279 Connected /dev/ttyUSB0 1436894493287 Device or Firmware Error A timeout occurred while connecting to the Board. Please check that you've properly flashed the board with the correct firmware. See: https://github.com/rwaldron/johnny-five/wiki/Getting-Started#trouble-shooting events.js:87 throw Error('Uncaught, unspecified "error" event.'); ^ Error: Uncaught, unspecified "error" event. at Error (native) at Board.emit (events.js:87:13) at […]

如何连续读取数据?

我正在尝试使用node.js从传感器连续读取数据。 假设我的传感器连接到Arduino的数字引脚4,在代码的节点端如何编程? 我做了这个:Node.js代码: var five = require("johnny-five"); var board = new five.Board(); board.on("ready", function() { this.pinMode(4, five.Pin.INPUT); this.loop(1,function(){ this.digitalRead(4, function(value) { console.log(value); }); }); }); 这是我得到的错误: (节点)警告:检测到可能的EventEmitter内存泄漏。 增加了11个数字阅读4听众。 使用emitter.setMaxListeners()来增加限制。 跟踪 在addListener(events.js:239:17) 在Board.digitalRead(C:\ Users \ Rahul \ Desktop \ NodeServoTest \ node_modules \ johnny-five \ node_modules \ firmata \ lib \ firmata.js:827:8) (匿名函数)[as digitalRead](C:\ Users \ […]

如何将带有传感器的初始化板作为模块导出

作为一个基本的例子,我有: //tempModule.js var five = require("johnny-five"); var board = new five.Board(); var temp; board.on("ready", function() { temp = new five.Temperature({ pin: "A2", controller: "AD8495" }); }); module.export = board; 哪些被调用: //moduleTest.js var board = require('tempModule.js'); setInterval(function(){ console.log("Temp: " + board.temp); },500); 此代码当前返回“未定义”。 如何构buildtempModule.js,以便连接到电路板的传感器的数据可以在其他程序中使用?

Node.js – 在Windows上安装johnny五库

我试图在Windows 7上安装Node.js的johnny五库,但不断收到错误: Your environment has been set up for using Node.js 0.10.15 (x64) and npm. C:\Users\User>npm install johnny-five npm http GET https://registry.npmjs.org/johnny-five npm http 304 https://registry.npmjs.org/johnny-five npm http GET https://registry.npmjs.org/colors npm http GET https://registry.npmjs.org/firmata npm http GET https://registry.npmjs.org/es6-collections npm http GET https://registry.npmjs.org/descriptor npm http GET https://registry.npmjs.org/lodash npm http GET https://registry.npmjs.org/compulsive npm http GET https://registry.npmjs.org/serialport npm […]

对于基于Arduino的项目,使用Johnny Five的外部C ++库

我需要在我的Johnny Five项目中使用RFID-RC522模块(这是一个NFC阅读器)。 有一个arduino库,可以很容易地与之交互: https : //github.com/miguelbalboa/rfid 我可以通过Johnny-Five使用这个图书馆吗? 如果是的话,怎么样?

用johnny-five和arduino读input引脚

我正在使用node.js和arduino应用程序。 我使用的是johnny-five框架,并且已经把标准草图草图上传到了我的arduino上,arduino的引脚2,3,4和5上连接了一个街机控制器。 这是我的实现: var five = require('johnny-five'); var board board = new five.Board(); board.on('ready', function(){ console.log('board is ready'); this.pinMode(2, five.Pin.INPUT); this.pinMode(3, five.Pin.INPUT); this.pinMode(4, five.Pin.INPUT); this.pinMode(5, five.Pin.INPUT); this.digitalRead(2, function(value) { if(value === 0) { console.log('up'); } }); this.digitalRead(3, function(value) { if(value === 0) { console.log('right'); } }); this.digitalRead(4, function(value) { if(value === 0) { console.log('left'); } […]

约翰尼五:董事会没有准备好

我以前有过我的Arduino套件在Breakout的同一个硬件上工作,但是想切换到Johnny Five 。 我的硬件连接了http://weblog.bocoup.com/javascript-arduino-programming-with-nodejs/的简单单一LED布局,但运行基本的LED闪光演示并不像预期的那样工作: var five = require("johnny-five"), board, led; board = new five.Board(); board.on("ready", function() { console.log('ready'); led = new five.Led(13); led.strobe(100); }); 返回: 1341154189666 Board Connecting… 1341154189697 Serial Found possible serial port cu.usbmodem621 1341154189699 Board -> Serialport connected cu.usbmodem621 1341154191570 Repl Successfully Connected 我直接在Firmata REPL没有LED闪光灯, board.ready是false 。 任何build议为什么board.readycallback不会被解雇?

使用Johnny-Five和React

我想用Johnny-Five和React JS创build一个接口。 我使用了这个React设置教程 。 我在同一个项目中安装了Johnny-Five: http : //johnny-five.io/ (Johnny-Five独立工作,独立应用程序,这使我可以控制我的Arduino)。 我的React index.js: import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; import MainRouter from './routes'; import registerServiceWorker from './registerServiceWorker'; import five from 'johnny-five'; var board = new five.Board({ port: "/dev/ttyACM0" }); board.on("ready", function() { var led = new five.Led(13); led.blink(500); }); ReactDOM.render( <MainRouter />, document.getElementById('root')) […]