How to control GPIO of Raspberry Pi with P5js

Hello everyone,

i try to create a web-interface for a robot wit P5js. Right now I am using python with bottle to do so. But it looks like, that p5js offers much more possibilities for such interaktive design. So my general questions is, how could a possible workflow for controlling GPIO from a webinterface done with P5js look like? Is it possible to do so from within P5js, or is there an easy workflow to transfer data do processing? I would manage to do this with TCP/IP, but it would be awesome to make this as simple as possible. Thanks in advance!

Best, Chris

Answers

  • Answer ✓

    Tagging @gohai. Maybe he has some suggestions.

    Kf

  • Answer ✓

    No expert in p5js, but you could try to use Processing's Network library to have your Processing sketch react to asynchronous HTTP requests coming from p5js, and use the GPIO library there to actually interact with the pins. Could be a neat idea for a library actually.

    I imagine that there are also GPIO libraries for Node, so I am guessing that you could use those in combination with p5js somehow?

  • Thank very much you for tagging kfrajer, thank you very much for answering gohai! That sounds like an approach. I will check this out and will give some feedback.

Sign In or Register to comment.