please try this :
gpio16 = mraa.Gpio(16, owner=True, raw=True)
please try this :
gpio16 = mraa.Gpio(16, owner=True, raw=True)
Thanks for the reply! !
That was the first thing I tried!
It’s no good.
How do you test the input?
import mraa
import time
pin = 3 # set pin num
try:
gpio = mraa.Gpio(pin)
gpio.dir(mraa.DIR_IN) # set mode as input
while True:
value = gpio.read() # read from pin 3
print("value: {}".format(value))
time.sleep(1)
except KeyboardInterrupt:
print("\nstop\n")
please try this example which I have tested
Thanks for testing! !
But when I try it, this error occurs.
Maybe the mraa installed on my Rock4SE is not good?
==========
Traceback (most recent call last):
File “/home/radxa/Documents/mraa_test_003.py”, line 7, in
gpio = mraa.Gpio(pin)
File “/usr/local/lib/python3.9/dist-packages/mraa.py”, line 479, in init
_mraa.Gpio_swiginit(self, _mraa.new_Gpio(pin, owner, raw))
ValueError: Invalid GPIO pin specified
really sorry! ! !
solved.
The program you tested worked when I ran it as super user.
sudo pyhton XXXX.py
*XXXX is the Python program name
This program also worked when I started it as super user! !
Nasca, thank you so much for your response! !
Just one thing.
Perhaps this pull-up setting is not working, right?
Looking at the mraa source code, it doesn’t seem to be working.
(Intel’s edison seems to support programmatic pull-ups, but no other boards seem to support it.)
Does this mean that the only solution to this problem is to wire a pull-up resistor?
@WATANABE i am newbie to rock4se project board. i am operating debian 11 bullseye on it.
i am unable to install mraa for debian. however i have installed mraa python 3 binding, can you please guide me how can i install mraa for debian.
i am also trying to read gpio pins using mraa.
Hello! !
I’m also a newbie, so I can’t say much, but I installed it as follows.
RockPi’s official libmraa cannot be downloaded, and the explanation Wiki is currently unavailable.
https://wiki.radxa.com/Rockpi4/dev/libmraa
However, I would like to use a library to use GPIO.
There are not many GPIO libraries like RaspPi.
RockPi has no choice but to use mraa.
By the way, the mraa library itself is a general-purpose library and is compatible with RockPi, as announced on the official website.
https://github.com/eclipse/mraa/blob/master/docs/rockpi4.md
Therefore, we have determined that the RaspPi method is also valid for installation.
Although it is a Japanese site, there was a site with instructions on how to install it, so I installed it using that as a reference.
Currently, I have installed this method and there are no problems.
Reference: Eclipse MRAA on Raspberry Pi 4 - Python
Just wondering, are you tied to Debian or could you use Armbian?
If you can go Armbian, the answer and results are different (as in easier).
thanks, mraa installation was successfull, but there were some issues when reading input voltages at gpio pins. i will share details later
yes i can shift to armbian also. currently i am working on another project for few days. I will update on this later.
Your instructions allowed me to install mraa successfully.
I am extremely grateful!
Thanks,
Matt
PS: There is one too many dots at the end of the “cmake” line.