Jump to content
Sign in to follow this  
shizimi

ASUS.GPIO input

Recommended Posts

I am programming with reference to the sample.
How can I see the 0,1 of the GPIO?
The 29th pin shows 3.3V when I look at it with a tester.
It will be 0 when printed.

import ASUS.GPIO as GPIO
  
GPIO.setmode(GPIO.BOARD)
GPIO.setup(29, GPIO.IN)

print(GPIO.input(29))

 

Share this post


Link to post
Share on other sites

The 29th pin is set to 1 in the gpio readall command.
3.3V was measured with a voltmeter between GND and pin.
I'm not sure why, but inserting add_event_detect solved it.
why?

import ASUS.GPIO as GPIO
  
GPIO.setmode(GPIO.BOARD)
GPIO.setup(29, GPIO.IN)

GPIO.add_event_detect(29, GPIO.BOTH)

print(GPIO.input(29)) # <- 1

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...