We have upgraded the community system as part of the upgrade a password reset is required for all users before login in.

No module named onionGpio

  • Hi! I'm receiving this message on my Blink project

    File "Blinkme.py", line 1, in <module>
    import onionGpio
    No module named onionGpio

    Any idea?

  • I've made the changes. Thank you. But now when i send the command : Python Blink.py
    The terminal does nothing .. only move to the next line

  • What is the code inside your Blink.py file?

  • That code does not give any output, it just toggles the value of GPIO0 ever 0.5 seconds. What do you expect it to do? Do you have a LED with current-limiting resistor connected to GPIO0 but it doesn't blink it?

  • @Maximilian-Gerhardt yes i have and doesn't blink

  • Check the LED direction, if you put the LED (=light emitting diode) in the wrong direction, it will not conduct current. Double check every connection. Try executing the script as root (sudo python Blink.py). If that doesn't help, reboot your Onion and retry. If that still doesn't help, use your multimeter to check the voltage level at GPIO0 with respect to ground, but make the sleepTime higher, e.g. 5, otherwise it will change too fast. If you are certain that the voltage at the GPIO pin doesn't change, you might have a hardware problem.

  • To debug things, it often helps to start at the lower level. Unfortunatley, these days we're a bit prone to the "libraritis disease". Libraries are fine to get things done, but they also add complexity and layers hard to see through when something does not work.

    There is no need for any library at all to test basic GPIO functions!

    There's the sysfs interface to gpio, built into the kernel. It's not complicated. To test if you can actually switch on a LED connected to GPIO0, you do:

    See if GPIO0 is already made available (by another piece of software) for user space control:

    ls /sys/class/gpio/gpio0

    If you get "No such file or directory", then it is not yet available and you need to "export" it, see next step. Otherwise, you can skip the next step.

    "Export", i.e. make GPIO0 available for controlling it from user space:

    echo 0 >/sys/class/gpio/export

    If you get an error here, some kernel level driver already claimed that pin for something, and neither you nor any user space library will be able to control it. In that case, you need to figure out what you have installed already that might want GPIO0 for itself. On a fresh Omega2, GPIO0 is available.

    If you got so far, GPIO is available for direct control.

    To make it an output:

    echo "out" >/sys/class/gpio/gpio0/direction

    To switch the output to high level (~3.3V):

     echo 1 >/sys/class/gpio/gpio0/value

    To switch it to low level (~0V):

     echo 0 >/sys/class/gpio/gpio0/value

    If your LED does not turn on and off this way, then you need to debug the wiring. No library can help before that works šŸ˜‰

Log in to reply

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