someone please tell me !!!
I’m currently using Rock4SE.
I have confirmed that the port can be turned on/off using the following method.
1)Move directory
cd /sys/class/gpio/
2)Create a file for the GPIO
sudo sh -c “echo 154 > export”
3) Specify as input port
sudo sh -c “echo in > gpio154/direction”
4) Pull up
sudo sh -c “echo ‘high’ > gpio154/direction”
5) Check port status
cat gpio154/value
However, even if I check the port switching using the source code below, it does not turn ON/OFF.
What’s wrong?
I think mraa is functioning because it displays the I/O list and the mraa version.
import mraa
import time
gpio16 = mraa.Gpio(154, owner=True, raw=True)
gpio16.mode(mraa.MODE_PULLUP)
gpio16.dir(mraa.DIR_IN)
while True:
if gpio16.read() == 1:
print(“ON”)
else:
print(“OFF”)
time.sleep(1)
gpio16.close()