You can also write the commands as a shell script like:Įcho out > /sys/class/gpio/gpio$1/direction You will find such files or dircotories: active_low, direction, edge, power, subsystem, uevent, value with ls command. with sudo nano export, and append 27 then save it, which also make the system generate a new directory gpio27. You can also add another gpio by editing the file export, e.g. In fact we add the number 26 to the file export, and the system will generate a new gpio directory gpio26. > symbol is a Redirection Operators which is often used to save the output of a command to a file. You might have questions about the > symbol. ![]() Here we are trying to setup GPIO26 for future use by the command: On Raspberry Pi, N is a number often be 0) List the files and you will find there are only such files: export, gpiochipN and unexport (here gpiochipN stands for a GPIO controller implementing GPIOs starting at #N, see: Documentation of sysfs. To setup a GPIO for future use, please first change the current directory to /sys/class/gpio.
0 Comments
Leave a Reply. |