12 063
правки
(Новая страница: «==The example of work in Linux==») |
|||
(не показаны 2 промежуточные версии этого же участника) | |||
Строка 31: | Строка 31: | ||
==The example of work in Linux== | ==The example of work in Linux== | ||
See [[GPIO/en|GPIO]]. | |||
# | # Find the GPIO number corresponding to the desired terminal in the table[[Список GPIO/en|WB2.8]]/[[WB SH 3.5: Список GPIO/en|WB3.5]]/[[Wiren Board 4: Список GPIO/en|WB4]]/[[Wiren Board 5:Список GPIO|WB5]]. For terminal strip number 2 in version 2.8, it is GPIO 32. | ||
# | # Export GPIO to sysfs | ||
#:<pre>root@wirenboard:~# echo 32 > /sys/class/gpio/export</pre> | #:<pre>root@wirenboard:~# echo 32 > /sys/class/gpio/export</pre> | ||
# | # Set the GPIO to output mode to control the transistor. This is required because GPIO can be in input mode and have a high impedance, leaving the transistor in an undefined state. | ||
#:<pre>root@wirenboard:~# echo out > /sys/class/gpio/gpio32/direction</pre> | #:<pre>root@wirenboard:~# echo out > /sys/class/gpio/gpio32/direction</pre> | ||
# | # Open the transistor, giving a logical high level to the gate: | ||
#:<pre>root@wirenboard:~# echo 1 > /sys/class/gpio/gpio32/value</pre> | #:<pre>root@wirenboard:~# echo 1 > /sys/class/gpio/gpio32/value</pre> | ||
# | # Close the transistor, giving a logical zero to the gate: | ||
#:<pre>root@wirenboard:~# echo 0 > /sys/class/gpio/gpio32/value</pre> | #:<pre>root@wirenboard:~# echo 0 > /sys/class/gpio/gpio32/value</pre> |
правки