You may want to write this in C, but I'm not completely convinced yet.
>
> - Writing a large buffer. For some (yet) unknown reason,
> process.binding('fs') fails with buffer larger than 8 octets. But trying to
> write 8 byte buffers is worthless, since only the first byte is taken into
> account. So i get the same result, 54-62 kHz.
>
> That is weird. Mihai is right though, if you could cross the js->c
boundary less, you'd be in better shape.
>
> - Creating a write stream and piping a '10101010' stream to it has two
> problems: 1. it only worked at about 13 kHz; 2. it is very unstable, since
> the garbage collector kicks in more often and the flow fluctuates a lot
> more.
>
> Yeah, this would probably be my main reason for doing this in C land
>
> - Creating a write stream and piping a read stream with manual "push"
> or emitting "data" events in a while(true) loop also failed, since the flow
> is unstable. For some reason, this method did not even pass 2 kHz.
>
> You don't want to use a while(true) in node because you'll starve the
event loop
> Still open for suggestions, I promise an ooscilloscope screenshot for
> every new idea :D
>
What about something like the following?
var fs = require('fs');
var buf = new Buffer(1024);
for (var i=0; i<buf.length; i++) {
buf[i] = i%2 ? 1 : 0; // maybe tuning this to 4,8,16 would give gpio
time to react? (I'm a noob)
}
var gpioFile = '/sys/class/gpio/gpio68/value';
var fd = fs.openSync(gpioFile, 'a');
(function write() {
fd.write(fd, buf, 0, buf.length, write);
})();
This is much like what Mihani mentioned, except we're trying to use
fs.write and pre-populating a buffer of reasonable size.
Hope it helps
--Elijah
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.