Configuring GPIO
-
To configure GPIO, perform the following:
Execute the following command to configure GPIO0:
cd /sys/class/gpio echo 448 > export
-
Locate to the GPIO0 directory:
cd gpio448
Note: In this command,448
represents the sys number of the pin. For more information, see GPIO Pinout. -
Configure the direction of GPIO0 as in:
echo in > direction
-
Alternatively, configure the direction of GPIO0 as out:
echo out > direction
-
Configure the voltage level of GPIO0 as high:
echo 1 > value
Tip: You can use an oscilloscope to check the voltage level. -
Configure the voltage level of GPIO0 as low:
echo 0 > value
Tip: You can use an oscilloscope to check the voltage level. -
Connect the 3.3V Power pin with the GPIO0, and check the voltage level of
GPIO0:
cat value
-
Connect the GND pin with the GPIO0, and check the voltage level of GPIO0:
cat value