我使用twitter streaming api
及johnny-five
与其他一些模块http
,express
及socket.io
用arduino uno
我的脚本在笔记本电脑上运行良好.但我的制作将在平板电脑上.我有两个平板电脑,两者都有不同的反应.在hp omni
平板电脑上我收到以下错误
此外,我已arduino-uno
连接端口,COM3
但其显示设备已连接COM1
据我所知,这个错误是standard firmata
在arduino没有上传的时候引起的.我上传了这个程序,它在笔记本电脑上运行良好
在Acer
平板电脑上我没有收到任何错误程序启动完全没有任何问题,但我没有收到推文twitter streaming api
我已多次交叉检查它在笔记本电脑上运行完全正常,每次我运行它,但给出了两个不同的问题 tablets
这是我正在使用的代码
var Twitter = require('twitter');
var five = require("johnny-five");
var express = require('express')
, app = express()
, http = require('http')
, server = http.createServer(app)
, io = require('socket.io').listen(server);
server.listen(8080);
// routing
app.use(express.static(__dirname + '/http'));
app.use(function (req, res, next) {
res.setHeader('Access-Control-Allow-Origin', "http://"+req.headers.host+':80');
res.setHeader('Access-Control-Allow-Methods', …
Run Code Online (Sandbox Code Playgroud) javascript node.js twitter-streaming-api arduino-uno johnny-five
我想使用Johnny-Five并使用React JS创建一个接口.
我使用了这个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'))
registerServiceWorker();
Run Code Online (Sandbox Code Playgroud)
当我运行React时,网站启动但是电路板没有反应!虽然没有React的相同代码可以很好地工作.任何让Johnny-Five与React合作的想法?
我以前让我的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);
});
Run Code Online (Sandbox Code Playgroud)
返回:
1341154189666 Board Connecting...
1341154189697 Serial Found possible serial port cu.usbmodem621
1341154189699 Board -> Serialport connected cu.usbmodem621
1341154191570 Repl Successfully Connected
Run Code Online (Sandbox Code Playgroud)
我最终直接进入Firmata REPL而没有LED频闪,而且board.ready
是false
.
为什么board.ready回调不会被解雇的任何建议?
我需要在我的Johnny Five项目中使用 RFID-RC522 模块(它是一个 NFC 阅读器)。
有一个 arduino 库,可以很容易地与之交互:https : //github.com/miguelbalboa/rfid
我可以通过 Johnny-Five 使用这个库吗?如果是,如何?
这是一个基本的理解问题。我正在尝试按照以下说明进行操作:http://www.barryvandam.com/node-js-communicating-with-arduino/,但是听起来有些不对劲。
据我之前了解,我只需要将标准的Firmata代码推入Arduino,并通过Node.js进行编码即可从Arduino调用动作和信息。但是在此链接中,他们指出我们需要将代码上传到Arduino,这显然会删除现在存在的Firmata代码。会导致与Arduino的连接松动吗?
它是如何工作的?
非常感谢!
我正在尝试使用npm安装Johnny Five,但我一直在收到错误.这是我在终端窗口中得到的.
gyp ERR! build error
gyp ERR! stack Error: not found: make
gyp ERR! stack at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:43:28)
gyp ERR! stack at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:46:29)
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/which/which.js:57:16
gyp ERR! stack at Object.oncomplete (fs.js:107:15)
gyp ERR! System Darwin 12.4.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/nevosegal/GitHub/node_modules/firmata/node_modules/serialport
gyp ERR! node -v v0.10.10
gyp ERR! node-gyp -v v0.9.6
gyp ERR! not ok
npm ERR! weird error 1
npm ERR! not ok code 0
Run Code Online (Sandbox Code Playgroud)
以下是日志文件.任何人?
2793 error Error: …
Run Code Online (Sandbox Code Playgroud) johnny-five ×6
node.js ×5
arduino ×4
firmata ×2
arduino-uno ×1
javascript ×1
npm ×1
reactjs ×1
rfid ×1