I’m playing around with my BBB and I’m using Ubuntu 13.04 [mainly as I’m familiar Ubuntu]
So far I have it up and running, and I’ve installed a basic LAMP setup[apache, PHP, mysql] as well as nodejs.
I cloned the bonescript repository and I can run
‘sudo /var/nodejs/bonescript/demos/blinkled.js’ successfully
I’m curious how the web server on the Angstrom MMC is configured. Mounting it’s partition, I don’t see anything in the cloud9/autorun folder so I’m not sure how web access to bonescript is setup there. I’d like to replicate that functionality so I can confirm things working in bonescript.
My goal is to port functions over to a PHP library as I need them since I prefer coding in PHP - I just like having the option to refer back to the source.
So, any hints on what packages are setup and configured in Angstrom to provide web access?
Stupid followup question. I want to save the variables from bone.js into json data files, ie:
exports.pins ==> save to pins.json
exports.pinIndex => save to pinIndex.json
exports.uarts ==> save to uarts.json
exports.i2c ==> save to i2c.json
I’d prefer to do this via a simple script so that I can re-run it whenever the file changes, ie my first stab was:
var b = require(‘bonescript’);
var fs = require(‘fs’);
var pinIndex = exports.pinIndex;
jsonString = JSON.stringify(pinIndex);
fs.appendFile("./pinIndex.json", jsonString, function(err) {
if(err) {
console.log(err);
} else {
console.log(“The file was saved!”);
}
});
This runs successfully, but the file pinIndex.json is empty - I am assuming I’m not doing something I need to do in order to load the data into accessible variables[not being very familiar with node.js].
My purpose here is to avoid reuse as much as possible from bonescript when creating my PHP library - so if I convert the board definitions to a json data file, it is extremely simple to read these files and parse them in PHP.
Anyone familiar enough with nodejs to give me a hint?