Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

gpio.init() crash?

Featured Replies

Hi to all,

I'm newer so I hope your comprehension.

my board Orange Pi Zero 512

my python script for turno on/off rele board works well, but only if call it directly form terminal.

If call it from cgi, crontab don't controll the rele board: gpio.init() semms crashed but the script complete its work.

What I'm wrong?

Thanks

 ----

from pyA20.gpio import gpio
from pyA20.gpio import port

gpioinit = gpio.init()
gpioscfg = gpio.setcfg(port.PA19, gpio.OUTPUT)     
gpio.output(port.PA19, gpio.LOW)

print "ok"

-----

 

Well if it 'seems' to crash I'm going to go ahead and assume it doesn't. If it does, provide log or error code. I'm going to assume it doesn't though if it works from command line.
I'm not sure what you mean by CGI and I'm also going to assume that you're running the entire script from command line and not each line of code from the python shell/prompt.

(I make this distinction because of personal experience)

 

That being said, what command are you calling with crontab?
Don't know why it would make a difference but seems worth mentioning: gpioinit variable is redundant since you aren't calling it later on. Try just gpio.init(). Same for setcfg().

So like this...

 ----

from pyA20.gpio import gpio
from pyA20.gpio import port

gpio.init()
gpio.setcfg(port.PA19, gpio.OUTPUT)     
gpio.output(port.PA19, gpio.LOW)

print "ok"

-----

  • Author

right!
Thanks for the answer

 

 yes, I'm running the script from command line and not each line of code...

 

Perhaps I've resolved: was only a problem of privilege, I've put "sudo user nopassword" on visudo and now gpio.init() don't stop working

 

Thanks

 

 

 

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.