Skip to content

Instantly share code, notes, and snippets.

@DiegoTc
Forked from Dicetog/CARD_0.html
Created August 11, 2014 12:34
Show Gist options
  • Save DiegoTc/1a38b383098389edcc83 to your computer and use it in GitHub Desktop.
Save DiegoTc/1a38b383098389edcc83 to your computer and use it in GitHub Desktop.
Bone101 Tutorial
<h1 style="font-size: 2em; font-family: Arial, Verdana, Helvetica, sans-serif; color: rgb(180, 162, 121); font-style: normal; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);">writeTextFile(filename, data, [callback])</h1><p style="font-size: 1.1em; line-height: 1.3em; color: rgb(82, 82, 82); font-family: Arial, Helvetica, Verdana, sans-serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);">Write the contents of a text (ASCII) file.</p><h2 style="font-size: 1.5em; font-family: Arial, Verdana, Helvetica, sans-serif; font-weight: normal; color: rgb(180, 162, 121); margin: 5px 0px; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);">Arguments</h2><ul style="color: rgb(82, 82, 82); font-family: Arial, Helvetica, Verdana, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><li><em>filename</em>: complete path of the file to be written</li><li><em>data</em>: ASCII string to be written</li><li><em>callback</em>: called upon completion</li></ul><h2 style="font-size: 1.5em; font-family: Arial, Verdana, Helvetica, sans-serif; font-weight: normal; color: rgb(180, 162, 121); margin: 5px 0px; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);">Return value</h2><h2 style="font-size: 1.5em; font-family: Arial, Verdana, Helvetica, sans-serif; font-weight: normal; color: rgb(180, 162, 121); margin: 5px 0px; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);">callback(x)</h2><ul style="color: rgb(82, 82, 82); font-family: Arial, Helvetica, Verdana, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><li><em>x.err</em>: error status message</li></ul>
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));
}
<p><span style="font-weight: bold;">writeTextFile(filename, data, [callback])</span></p><p><span style="color: rgb(82, 82, 82); font-family: Arial, Helvetica, Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 17.15999984741211px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: rgb(255, 255, 255);">Write the contents of a text (ASCII) file.</span></p>
Preview Card 1
Arguments
Example Code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment