Skip to content

Instantly share code, notes, and snippets.

@sofroniewn
Last active February 25, 2016 22:17
Show Gist options
  • Save sofroniewn/206dab0653021ac0b91f to your computer and use it in GitHub Desktop.
Save sofroniewn/206dab0653021ac0b91f to your computer and use it in GitHub Desktop.
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)
})
})
@sofroniewn
Copy link
Author

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

@sofroniewn
Copy link
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