Accessing GPIO from Perl, Python, and Ruby

February 7, 2013 — 1 Comment

I started this smallish project to overcome coder’s block and original idea was to implement it in only one scripting language. I chose Python as I believed it had most clear API but then I decided to throw in Perl and Ruby as well. It was more exercise in building C extensions then in actual system programming but it was fun nonetheless. All three sub-projects lack proper documentation but there are examples that should be enough to get started.

Sources available on github.



One response to Accessing GPIO from Perl, Python, and Ruby

  1. Hi

    Your code doesn’t work with Python 3.
    To fix this we must slightly change the file _bsdgpiomodule.c
    Here is a patch for this file:

    > static struct PyModuleDef _bsdgpiomodule = {
    > PyModuleDef_HEAD_INIT,
    > “_bsdgpio”,
    > “BSD GPIO Module”,
    > -1,
    > GpioMethods
    > };
    m = PyModule_Create(&_bsdgpiomodule);
    return NULL;
    > return m;

Leave a Reply


Text formatting is available via select HTML. <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>