04-08-2019, 08:50 PM
(This post was last modified: 04-08-2019, 08:59 PM by robotgruntxd.)
I was using python GPIO library for ROCK64: Rock64-R64.GPIO and it didnt work, i used an offset of 1000 as is in this repository Matei Rock64-R64.GPIO , modified the offset to be 1002 and just work for pin 16 with this script:
# Set Variables
var_gpio_out = 16
# GPIO Setup
GPIO.setwarnings(True)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(var_gpio_out, GPIO.OUT, initial=GPIO.HIGH) # Set up GPIO as an output, with an initial state of HIGH
# Test Output
print("Testing pin: " + str(var_gpio_out))
print("Testing GPIO Input/Output:")
while True:
print("HIGH")
GPIO.output(var_gpio_out, GPIO.HIGH)
sleep(1)
print("LOW")
GPIO.output(var_gpio_out, GPIO.LOW)
sleep(1)
After that i was trying to use this commands to make work each pin, i chose numbers randomly.
firefly@firefly:~$ ls /sys/class/gpio/
export gpiochip1000 gpiochip1032 gpiochip1064 gpiochip1096 gpiochip1510 unexport
# enter root mode
firefly@firefly:~$sudo -i
# using pin 16
root@firefly:~# sudo echo 1103 > /sys/class/gpio/export
# set pin 16 to 0
root@firefly:~# echo 0 > /sys/class/gpio/1103/value
root@firefly:~# echo 1 > /sys/class/gpio/1103/value
after try and error with many numbers i found that 1103 works for pin 16 and 1101 works for pin 18, but i cant figure out the others numbers.
# Set Variables
var_gpio_out = 16
# GPIO Setup
GPIO.setwarnings(True)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(var_gpio_out, GPIO.OUT, initial=GPIO.HIGH) # Set up GPIO as an output, with an initial state of HIGH
# Test Output
print("Testing pin: " + str(var_gpio_out))
print("Testing GPIO Input/Output:")
while True:
print("HIGH")
GPIO.output(var_gpio_out, GPIO.HIGH)
sleep(1)
print("LOW")
GPIO.output(var_gpio_out, GPIO.LOW)
sleep(1)
After that i was trying to use this commands to make work each pin, i chose numbers randomly.
firefly@firefly:~$ ls /sys/class/gpio/
export gpiochip1000 gpiochip1032 gpiochip1064 gpiochip1096 gpiochip1510 unexport
# enter root mode
firefly@firefly:~$sudo -i
# using pin 16
root@firefly:~# sudo echo 1103 > /sys/class/gpio/export
# set pin 16 to 0
root@firefly:~# echo 0 > /sys/class/gpio/1103/value
root@firefly:~# echo 1 > /sys/class/gpio/1103/value
after try and error with many numbers i found that 1103 works for pin 16 and 1101 works for pin 18, but i cant figure out the others numbers.