Sunday, 7 May 2017

django : raspberry pi LED using javascript

I'm developing my own WEB using Django web frame. I'm trying to turn Raspberry pi LED on only using Javascript.

 var gpio = require("pi-gpio");
    gpio.open(16, "output", function(err){
      gpio.write(16, 1, function(){
        gpio.close(16);
    });
  });

<script src='../static/bundle.js'></script>

I downloaded browserify to use require module in my browser SO, I made by typing 'npm run build' in terminal. But, I got this error

Uncaught TypeError: fs.readFileSync is not a function
  at Object.5.child_process(bundle.js:436)
  at s (bundle.js:1)
  at bundle.js:1
  at Object.1.pi-gpio (bundle.js:2)
  at s (bundle.js:1)
  at e (bundle.js:1)
  at bundle.js:1



via Gilho Lee

No comments:

Post a Comment