Raspberry Pi Zero W

Posted on
  • I have successfully installed Espruino at my raspberry pi zero w. Also wiringPi is installed before the Espruino make.
    In a command-box the following will switch on my led: gpio -g write 23 1.

    However in Espruino: D23.write(HIGH) will not switch the Led.
    What did I forget?

  • You might have to run it with sudo so it has priviledges to access the hardware?

    Also, does:

    echo 23 > /sys/class/gpio/export 
    echo out > /sys/class/gpio/gpio23/direction
    echo 1 > /sys/class/gpio/gpio23/value

    work for you in the shell? I'm not 100% sure how the gpio command works.

  • Your commands only work after: gpio export 23 output.

    Without this command setting, I am not allowed to write to the ..gpio23/value. Also using sudo doesn't allow me to write

  • That's a bit weird. You know sudo echo 23 > /sys/class/gpio/export won't have the right effect though, since only the echo will be run as sudo, not the > bit? You'd have to sudo bash and then type the commands in there.

    What OS are you using? Raspbian Stretch? I can't say I've used Stretch yet, but Jessie worked great.

  • sudo bash ... will only work after I typed: gpio export 23 output.
    Without the last command I receive the error:
    bash: /sys/class/gpio/gpio23/value: No such file or directory

    I am using Raspbian Stretch.

  • Hmm. Where do you type gpio export? That sounds like it's inside Python's wiringpi library? Do you shut Python down first? It might be interfering somehow.

    If /sys/class/gpio/export doesn't work, you'll need to get that sorted first. That's pretty much the most basic way of using GPIO, and if it doesn't work then I guess you have other issues. Maybe you could ask on the Pi forum, or does someone else have some ideas?

    Have you tried with any other GPIOs? It might be that 23 is used by something else?

  • the Gpio utility comes with wiringPi.
    I just uninstalled wiringPi and now I can use the echo commands without sudo.

    However Espruino still no results on all gpio-ports.

  • Well, it's a start I guess. What about running Espruino with sudo? You definitely need it to get the low-level wiringpi access

  • sudo will not help. Installing Jessie now. Maybe that helps.

  • Just installed Jessie. Unfortunately the same problem happens.

  • I finally got it working after the command: gpio export 23 output

    I have to run this command for each gpio port.

  • Thanks for letting us know - it sounds a bit like it's not actually using WiringPi but the filesystem GPIO, but hey - if it works then great.

  • Do I need the wiringPi for rf433 support?

  • The first one: 433Mhz

  • Yes, you would if you want to receive - I think you might be ok for sending. You'll struggle a bit with reliability on Raspberry Pi anyway, because with the Operating System you can't guarantee accurate timing - you'd be much better off plugging an external microcontroller like the Pico into the Pi, so you can leave that to do the accurate timing stuff.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Raspberry Pi Zero W

Posted by Avatar for LouisvanGeldrop @LouisvanGeldrop