Community
cancel
Showing results for 
Search instead for 
Did you mean: 
SGupt29
Novice
1,180 Views

Intel Edison won't run XDK Project on Startup

My Intel Edison Project, a modification of the example:

/*jslint node:true, vars:true, bitwise:true, unparam:true */

/*jshint unused:true */

/*global */

/*

A simple node.js application intended to read data from Analog pins on the Intel based development boards

such as the Intel(R) Galileo and Edison with Arduino breakout board, and display it in a browser running on the client.

This demonstrates use of http.createServer, and fs.

MRAA - Low Level Skeleton Library for Communication on GNU/Linux platforms

Library in C/C++ to interface with Galileo & other Intel platforms, in a structured and sane API with port nanmes/numbering that match boards & with bindings to javascript & python.

Steps for installing MRAA & UPM Library on Intel IoT Platform with IoTDevKit Linux* image

Using a ssh client:

1. echo "src maa-upm http://iotdk.intel.com/repos/1.1/intelgalactic http://iotdk.intel.com/repos/1.1/intelgalactic" > /etc/opkg/intel-iotdk.conf

2. opkg update

3. opkg upgrade

Article: https://software.intel.com/en-us/xdk-sample-creating-a-web-server https://software.intel.com/en-us/xdk-sample-creating-a-web-server

*/

// Set this to the ip address of your board (not 127.0.0.1)

var ipAddress = '192.168.1.80';

var mraa = require('mraa'); //require mraa

console.log('MRAA Version: ' + mraa.getVersion()); //write the mraa version to the console

// Start by loading in some data

var fs = require('fs');

var lightSensorPage = fs.readFileSync('/node_app_slot/lightsensor.html');

// Insert the ip address in the code in the page

lightSensorPage = String(lightSensorPage).replace(/<<ipAddress>>/, ipAddress);

var myDigitalPin6 = new mraa.Gpio(6); //setup digital read on Digital pin # 6 (D6)

myDigitalPin6.dir(mraa.DIR_IN); //set the gpio direction to input

/**

* Given a value, convert it to Lux

*

* This uses the table given in the documentation for the

* Grove Starter Kit Plus. We have not sought to verify these

* values with our device. That would be worth doing if you

* intend to rely on these values. In that case, it could also

* be worthwhile to improve the interpolation formula

* @param {Number} - the raw reading from the device

*/

var http = require('http');

http.createServer(function (req, res) {

var value;

// This is a very quick and dirty way of detecting a request for the page

// versus a request for light values

if (req.url.indexOf('lightsensor') != -1) {

res.writeHead(200, {'Content-Type': 'text/html'});

res.end(lightSensorPage);

}

else {

value = myDigitalPin6.read();

res.writeHead(200, {'Content-Type': 'text/json'});

res.end(JSON.stringify(value));

}

}).listen(1337, ipAddress);

Once uploaded to the board in the Intel XDK, can be run using the run button. If i unplug the board and plug it back in, the project won't run on startup, but after it starts up, i can manually start it by using the run button in the XDK IDE. Any help?

I am using the mini breakout and the Yocto 3.0 image.

9 Replies
idata
Community Manager
128 Views

Hi Shiven,

 

 

If you want to start your script automatically when the Edison boots, I recommend you to create a system service to run the script on startup. You would have to create a script directly in the Edison's console instead of uploading it using the XDK. You could still using the XDK to make sure the script works as expected, and then create the system service to run it on startup. The following document describes the process you should follow to create a system service: /docs/DOC-111103 https://communities.intel.com/docs/DOC-111103

 

 

Regards,

 

Diego
SGupt29
Novice
128 Views

Are you sure? The LED Blink example works on startup.

idata
Community Manager
128 Views

Hi Shiven,

 

 

I've just tested the Blink example and it didn't start after I rebooted the board. I'm using the Yocto image version 3.0 too, but I'm not able to get any code from the XDK running after a reboot. Besides the Blink example, have you tested any other code to see if it runs on startup?

 

 

Regards,

 

Diego
SGupt29
Novice
128 Views

idata
Community Manager
128 Views

Hi Shiven,

I tested your code and I was able to get it running on startup. Then, I tested the following Blink example: https://github.com/intel-iot-devkit/mraa/blob/master/examples/javascript/Blink-IO.js https://github.com/intel-iot-devkit/mraa/blob/master/examples/javascript/Blink-IO.js, but the code didn't run on startup. Then, I tested your code again but this time, I wasn't able to get it running on startup.

Let me run additional tests to see why this behavior is happening.

Regards,

 

Diego
SGupt29
Novice
128 Views

Hi,

This also happens to me sometimes, but I can fix this be clearing the node app slot directory in upload control in the ide.

I do this a couple of times and it works. Not sure what is going on

idata
Community Manager
128 Views

Hi Shiven,

 

 

Just to let you know that we're still looking into this.

 

 

Once we have updates, we'll let you know.

 

 

Regards,

 

Diego

 

RRobe17
New Contributor I
128 Views

Very odd, I never had any issues with my code running after a reboot.

WaiLun_P_Intel
Employee
128 Views

Hi Shiven,

Has your issue been resolved? Please ensure that you have enabled "Automatically run after upload" in the upload options:

Thanks,

Wai Lun

Reply