Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. const Gpio = require('rpio2').Gpio;
  2. const fs = require('fs');
  3. var gs = Gpio.createReadStream(32, {throttle: 100});
  4. gs.pipe(fs.createWriteStream("result.json"));
  5. var gpio = new Gpio(32);
  6. gpio.open(Gpio.INPUT);
  7. gpio.on('falling', function()
  8. {
  9. console.log("PIN HIGH");
  10. });
  11. console.log(gs.read());
  12.  
  13. process.on("SIGINT", function(){
  14.  
  15.  
  16. gs.end();
  17. process.exit(0);
  18. });
  19. var r = Math.random() * (23 - 21) + 21;
  20. console.log(r);
  21. //PiMotion = require('node-pi-motion');
  22.  
  23. //var options = {
  24. // verbose: true,
  25. //throttle: 200
  26. //}
  27.  
  28. //var nodePiMotion = new PiMotion(options);
  29.  
  30. //nodePiMotion.on('DetectedMotion', function() {
  31. // console.log('Motion detected! Now do something.');
  32. //});
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement