Beagle Board - beagleboard.org

BonesSript

writeTextFile(filename, data, [callback])

Write the contents of a text (ASCII) file.

Arguments

  • filename: complete path of the file to be written
  • data: ASCII string to be written
  • callback: called upon completion

Return value

callback(x)

  • x.err: error status message

Example

var b = require('bonescript');
var file = '/sys/class/leds/beaglebone:green:usr3/trigger';
b.writeTextFile(file, 'heartbeat', readStatus);
function readStatus(x) {
    console.log(JSON.stringify(x));
    b.readTextFile(file, printStatus);
}
function printStatus(x) {
    console.log(JSON.stringify(x));
}

Build and execute instructions

  • Be careful not to overwrite important files!
  • Run the above to see the USR3 LED start to blink in a heartbeat pattern.
  • Adjust the LED selection and trigger.

See also

Related functions

Examples


Last updated by blog.hangerhead.com on Fri Jun 21 2013 14:40:43 GMT-0000 (UTC).
757