b.writeTextFile HELP Just not woking for me ???

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
tvtent
 
Posts: 1
Joined: Tue Mar 22, 2016 5:52 pm

b.writeTextFile HELP Just not woking for me ???

Post by tvtent »

I have a totally newbie question
b.writeTextFile Just not woking for me ???
If I run the BBB demo page script no problem but when I try my code I get (Uncaught TypeError: Cannot read property 'writeTextFile' of undefined)
Please what am I doing wrong?

Code: Select all

<html>
<body>
    <head>
    <title>Internet of Things with BeagleBoard.org</title>
    <script src="jquery.js"></script>
    <script src="bonescript.js"></script>
   <!-- //<script src="processing.js"></script>-->
   <script>
//var fs = require("fs");
var b = require('bonescript');
//var fs = require('fs');
function myFunction() {
    var x = document.getElementById("myText").value;
    document.getElementById("demo").innerHTML = x;
    console.log(x);                                                              // the log prints out correctly
    b.writeTextFile('/var/lib/cloud9/erw.txt',"header info");            // this is where i get my error
}
   </script>
</head>

First Name: <input type="text" id="myText" value="Mickey">

<p>Click the button to display the value of the value attribute of the text field.</p>

<button onclick="myFunction()">Try it</button>
<p id="demo"></p>

</body>
</html>


User avatar
drewfustini
 
Posts: 944
Joined: Sat Dec 26, 2015 1:19 pm

Re: b.writeTextFile HELP Just not woking for me ???

Post by drewfustini »

Does the writeTextFile() example in bone101 work for you?
http://beagleboard.org/Support/BoneScri ... eTextFile/

Also, it would be useful to know what system software is running on your beaglebone.

Please paste the output of:

cat /etc/dogtag

cat /etc/issue

uname -a

Locked
Please be positive and constructive with your questions and comments.

Return to “Beagle Bone & Adafruit Beagle Bone products”