When I run my javascript in Cloud9 I get the following warning and I don't
know what it means.

Also I can't access the web page the script is supposed to be serving. The
relevant code is posted below the warning.

 

Running Node Process

Your code is running at 'http://0.0.0.0:46464'.

Important: in your scripts, use 'process.env.PORT' as port and '0.0.0.0' as
host.

info: socket.io started

Server running on: http://192.168.10.108:8080

 

Code Start:

 

var app = require('http').createServer(handler);

var io = require('socket.io').listen(app);

var fs = require('fs');

var b = require('bonescript');

 

app.listen(8080);

// socket.io options go here

io.set('log level', 2); // reduce logging - set 1 for warn, 2 for info, 3
for debug

io.set('browser client minification', true); // send minified client

io.set('browser client etag', true); // apply etag caching logic based on
version number

 

console.log('Server running on: http://' + getIPAddress() + ':8080');

 

var outputPin1 = "P8_16";        //0.5dB  

var outputPin2 = 'P8_11';        //1dB

var outputPin3 = 'P8_12';        //2dB

var outputPin4 = 'P8_14';        //4db

var outputPin5 = 'P8_15';        //8dB

var outputPin6 = 'P8_17';        //Latch Enable

 

// configure pins and set all low

b.pinMode(outputPin1, 'out');

b.pinMode(outputPin2, 'out');

b.pinMode(outputPin3, 'out');

b.pinMode(outputPin4, 'out');

b.pinMode(outputPin5, 'out');

b.pinMode(outputPin6, 'out');

 

function handler (req, res) {

  if (req.url == "/favicon.ico"){ // handle requests for favico.ico

  res.writeHead(200, {'Content-Type': 'image/x-icon'} );

  res.end();

  console.log('favicon requested');

  return;

  }

  fs.readFile('webpage.html', // load html file

  function (err, data) {

    if (err) {

      res.writeHead(500);

      return res.end('Error loading webpage.html');

    }

   res.writeHead(200);

    res.end(data);

  });

}

io.sockets.on('connection', function (socket) {

// This is where we check the status of each Switch on the GUI

 

socket.on('Output1', function (data) {

    if (data == 'on') {

       //Set the Pin High

       b.digitalWrite(outputPin1,1);

       console.log ("0.5dB On");

    } else if (data == 'off') {

       //Set the Pin Low

       b.digitalWrite(outputPin1,0);

       console.log ("0.5dB Off");

    }

  });

 

.

.

.

.

// Get server IP address on LAN

function getIPAddress() {

  var interfaces = require('os').networkInterfaces();

  for (var devName in interfaces) {

    var iface = interfaces[devName];

    for (var i = 0; i < iface.length; i++) {

      var alias = iface[i];

      if (alias.family === 'IPv4' && alias.address !== '127.0.0.1' &&
!alias.internal)

        return alias.address;

    }

  }

  return '0.0.0.0';

}

 

 

 

 

 

 

 

 
<http://www.packtpub.com/building-a-home-security-system-with-beaglebone/boo
k>
http://www.packtpub.com/building-a-home-security-system-with-beaglebone/book

 

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to