Skip to content

Instantly share code, notes, and snippets.

@fknaopen
Created May 17, 2012 17:59
Show Gist options
  • Save fknaopen/2720579 to your computer and use it in GitHub Desktop.
Save fknaopen/2720579 to your computer and use it in GitHub Desktop.
(node.js on beagle board) enables usr1-LED
// beagle board
// change trigger usr1-LED
var fs = require('fs');
function led_read() {
fs.readFile('/sys/class/leds/beagleboard::usr1/trigger', 'utf-8',
function(err,data) {
if (err) {
return console.log(err);
} else {
console.log(data);
}
});
}
function led_write() {
fs.writeFile('/sys/class/leds/beagleboard::usr1/trigger', 'heartbeat',
function(err) {
if (err) {
return console.log(err);
} else {
// read usr1 led
led_read();
}
});
}
console.log('1----\n');
led_read();
led_write();
console.log('2----\n');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment