Last active
February 25, 2016 22:17
-
-
Save sofroniewn/206dab0653021ac0b91f to your computer and use it in GitHub Desktop.
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
| console.log('Hello Pi') | |
| var raspi = require('raspi-io') | |
| var five = require('johnny-five') | |
| var board = new five.Board({ | |
| io: new raspi() | |
| }) | |
| board.on('ready', function() { | |
| console.log('Board ready') | |
| var output = new five.Pin({ | |
| pin: 0, | |
| mode: 1, | |
| freq: 1 | |
| }) | |
| var input = new five.Pin({ | |
| pin: 2, | |
| mode: 0, | |
| freq: 1 | |
| }) | |
| input.read(function(error, value) { | |
| output.write(value) | |
| }) | |
| }) |
Author
Author
Update revision two so directly reading / writing pin in johnny-five - set sampling freq to 1 ms, still see ~10ms latencies that are highly variable
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note that some of this extra latency compared to using the firmata protocol directly can be traced to a 5ms debounce in switch
https://github.com/rwaldron/johnny-five/blob/master/lib/switch.js#L35-L46