Difference between revisions of "GPIO use from terminal"
From fit-PC wiki
(Created page with " = (Linux-Bash)= * Give permissions to your /dev/ttyACMX (Tel-GPIO), For Example: <code>sudo chmod 777 /dev/ttyACM0</code> * Configure the serial speed: <code>sudo stty -F...") (change visibility) |
|||
Line 6: | Line 6: | ||
− | * Configure the | + | * Configure the device: |
− | <code>sudo stty -F /dev/ttyACM0 | + | <code>sudo stty -F /dev/ttyACM0 1:0:1cb2:0:3:1c:7f:15:4:5:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0</code> |
Latest revision as of 12:47, 22 February 2024
(Linux-Bash)
- Give permissions to your /dev/ttyACMX (Tel-GPIO), For Example:
sudo chmod 777 /dev/ttyACM0
- Configure the device:
sudo stty -F /dev/ttyACM0 1:0:1cb2:0:3:1c:7f:15:4:5:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
- Read the serial-gpio output from background:
sudo cat /dev/ttyACM0 &
- For get Help/Commands write this:
echo "-h" > /dev/ttyACM0
GPIO Read
- Get GPIO level value: (X = number of GPIO pin)
echo "@X" > /dev/ttyACM0
- Get GPIO state: (X = number of GPIO pin)
echo "?X" > /dev/ttyACM0
Write/configure GPIO
- Set GPIO as Output pin: (X = number of GPIO pin)
echo "&X" > /dev/ttyACM0
- Set GPIO as Input pin: (X = number of GPIO pin)
echo "%X" > /dev/ttyACM0
- Set GPIO level HIGH: (X = number of GPIO pin)
echo "^X" > /dev/ttyACM0
- Set GPIO level LOW: (X = number of GPIO pin)
echo "_X" > /dev/ttyACM0