Created
May 17, 2012 17:59
-
-
Save fknaopen/2720579 to your computer and use it in GitHub Desktop.
(node.js on beagle board) enables usr1-LED
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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