- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Guys!
Let me sketch my project before I'll describe my problem. I want to build a node.js server on my galileo gen 2. Server will be responsible for downloading color sequences from the internet (using wifi), analysing this sequences using johnny-five and node-pixel libraries, sending this to arduino due using usb host and finally displaying desired colors on LED diodes strip (WS2812B). Code looks as follows:
var express = require('express'),
app = express(),
server = require('http').createServer(app),
io = require('socket.io').listen(server),
SerialPort = require('serialport').SerialPort;
var pixel = require("node-pixel");
var five = require("johnny-five");
var strip;
server.listen(3000);
var board = new five.Board({
port: new SerialPort("/dev/ttyACM0", {
baudrate: 240000,
buffersize: 1,
})
});
board.on("ready", function() {
console.log("Board on");
strip = new pixel.Strip({
data: 6,
length: 150,
board: this,
controller: "FIRMATA",
});
strip.on("ready", function() {
//test to check if everything works
console.log("Strip ready, let's go");
//display green color on 5th pixel.
strip.pixel(4).color("rgb( 000 , 255 , 000)");
strip.show();
});
});
app.get('/', function(req, res){
console.log("Connected");
});
io.sockets.on('connection', function(socket){
socket.on('send pixels', function(data){
//socket which sends led colors to arduino due
});
});
When I run this code on galileo I get on output:
root@galileo:/node_app_slot# node main.js
1444644264675 SerialPort /dev/ttyACM0 1444644264761 Connected /dev/ttyACM0Illegal instruction
I don't know what to do with that. Maybe some of you faced the same problem? I'll add that when I'll run this code on computer it works fine.
Node version: v0.10.38
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
What image are you using? I tried to run the code and got an error on the first try, because the libraries you are using are missing. From where did you download the Johnny-five and the node-pixel libraries and how did you install them?
Were those 3 lines the full error you received? I noticed in your code you use a baudrate of 240000. Can you try with 152000?
Sergio
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1. Image version: 3.8.7-yocto-standard GNU/Linux
2. Libraries are missing because you have to download them I download node.js modules using npm. So u need to use command (in node_app_slot folder): npm install express socket.io serialport johnny-five node-pixel
3. Those three lines are related with lines 12-18.
4. I'll try to decrease this baudrate
Konrad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi cola,
Were you able to run the code correctly? What were your results after changing the baudrate?
Sergio
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi !
I am running code using Intel XDK IoT edition.
Results after running code - the same ;/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Is that the full error log, if not post the full log. I ran the same code and also received
444644264675 SerialPort /dev/ttyACM0
1444644264761 Connected /dev/ttyACM0
I didn't receive an "Illegal instruction" error, I received a "undefined" error plus some other error lines. Have you tried to run the code directly from Linux instead of the XDK?
Sergio
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi cola19,
Do you have updates in this?
Could you attach the full error log?
What is the outcome of running uname –a?
Which XDK version are you using?
Did you try to run the code from Linux side?
Kind regards
Charlie

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page