Node.js GPIO Wrapper



  • I built a very simple Node.js GPIO wrapper that works on the older, supported version of node that runs on the Omega. It's a work in progress but the basics are there and documented. Currently it uses Sysfs but I'd like to eventually write a C extension for it. I would love feedback if anybody gives it a try.

    https://github.com/sidwarkd/omega_js



  • @Kevin-Sidwar I am far from an expert in Nose.js, but if I read you correctly when you say I'd like to eventually write a C extension for it I guess you mean you need some C/C++ code that accesses GPIO pins.

    If so, you may be interested in the code I have posted in https://community.onion.io/topic/143/alternative-c-code-for-gpio-access-now-with-interrupts-and-expled/20 that provides both static and dynamic linked C++ libraries for direct access to GPIO pins via the GPIO memory registers.
    The latest version of this code is in the new-gpio-1.3.1.tar.bz2 archive file attached to the above post.
    This archive file contains sources, makefiles and build products for the libraries and for some programs that use them along with fairly detailed documentation in a .pdf file.

    You are welcome to use and adapt any of that code if it is of any use to you.

    As an aside, I have also written a full set of Java wrappers that provide access to the same functionality via some C++ JNI code (jamvm is used to run Java code on the Omega). This has all been tested but needs a little more tidying up and documenting before I publish it.



  • Hey @Kit-Bishop , I really appreciate that. Yes, I'd prefer to access the GPIO pins on the level that you do in your C++ code. I've never written a node C extension before but it's very well documented so I'd like to take your code and build the wrapper layer around it. I think it would be amazing. I'm not sure when I'll have time to work on it but if I have any questions about your code I'll definitely reach out and certainly give you full credit in the project for the C code. Thanks again.



  • Thanks for posting your code. That helped me figure out how to access GPIO via Python.



  • @Brian-Piersel No problem. Glad it helped.



Looks like your connection to Onion Community was lost, please wait while we try to reconnect.