-
-
Save DiegoTc/1a38b383098389edcc83 to your computer and use it in GitHub Desktop.
Bone101 Tutorial
This file contains hidden or 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
<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> |
This file contains hidden or 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
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)); | |
} |
This file contains hidden or 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
<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> |
This file contains hidden or 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
Preview Card 1 | |
Arguments | |
Example Code |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment