Quantcast
Viewing all articles
Browse latest Browse all 486

OrangePi Zero - GPIO question

Hi,

 

I have probably trivial question related to GPIO on Orange Pi Zero.

 

So - I have a switch there connected ot 3.3V and then to GPIO (pin 12 on Zero).

What I want to do is just to read GPIO state. When button pressed it goes to high state - normally.

 

On RaspberryPi and Odroid C1 that works fine just using basic code with wiringpi2 or eventually wiringpi.

So I tried the same on Zero compiling wiring for H3/H2. 

My code is basic in Python:

import time
import wiringpi
import pyA20 as GPIO

cykl = 1
wiringpi.wiringPiSetupGpio #or wiringPiSetup()
wiringpi.pinMode(1,0)
while cykl == 1 :
 do_call = wiringpi.digitalRead(1)
 if do_call:
   print 'pressed'
 time.sleep(0.05)

On other arm machines it works.

 

Did I missed something with ZERO? 

I do not have any error - but so far I never got change of the state to 1. I assume in mapping PIN 12 is GPIO1 or eventually GPIO7.

Is this correct?

 

I think I have missed something there - probably very basic.....

 

Thanks in advance for help....

 

Michal


Viewing all articles
Browse latest Browse all 486

Trending Articles