Hello friend. I think maybe is too late for you, but if someone is alredy
looking for information about that, i took the solution.
In the bonescript library i didn't find a function to append in a text
file, so i used the function appendFile(), from node.js library. To use
this function, we have to write var fs = require('fs');
In my code, i read the value of a pin and i write this value on a text
file, append to the other values. This is my code:
var b = require('bonescript');
*var fs = require('fs');*
b.pinMode('P9_11', b.INPUT);
setInterval(copyInputToFile, 1000);
function copyInputToFile() {
b.digitalRead('P9_11', writeToFile);
function writeToFile(x) {
b.echo(x.value);
* fs.appendFile('datos.txt', x.value);*
}
}
I hope you find it useful.
Pedro Salcedo
El lunes, 20 de octubre de 2014, 20:09:23 (UTC+2), [email protected]
escribió:
>
> Hello all.
> This is probably a dumb question but, is there a way to write to a text
> file using Bonescript without erasing the current contents of the file? I
> am using writeTextFile, but the file content gets replaced by the last data
> sent there.
> I am trying to output the readings of a sensor to an ASCII text file every
> set interval of time. I am very new to BeagleBone, and my application is
> quite simple, so I am trying to do this the easiest way possible.
> Thanks.
>
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/beagleboard/7ebbea8d-25de-4b2a-aad5-7ac10eee34ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.