GPIO use from terminal
From fit-PC wiki
Revision as of 07:49, 7 February 2024 by Andreym (Talk | contribs) (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...")
(Linux-Bash)
- Give permissions to your /dev/ttyACMX (Tel-GPIO), For Example:
sudo chmod 777 /dev/ttyACM0
- Configure the serial speed:
sudo stty -F /dev/ttyACM0 115200
- 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