6 Replies Latest reply on Nov 6, 2015 5:10 PM by CMata_Intel

    Problem with Johnny-five and node-pixel library on galileo node.js server

    cola19

      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/ttyACM0                                                                                                                                                                                            

      Illegal 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