djmcg Posted December 15, 2018 Posted December 15, 2018 Hello Could You advice how to steering my GPIO output I need set "+" for this 4 canal 31 33 35 37 I already have the connect but can`t fine tutorial on web how to do it.
martinayotte Posted December 15, 2018 Posted December 15, 2018 1 hour ago, djmcg said: I need set "+" for this 4 canal 31 33 35 37 You could use gpio sysfs as it is the most easy way. pin31,33,35,37 are respectively PB5,PB6,PB7 and PD5. In gpio sysfs, they becomes gpio37,gpio38,gpio39 and gpio101. Here are the command to turn a gpio37 into output and set level output state : echo 37 > /sys/class/gpio/export echo "out" > /sys/class/gpio37/direction echo 1 > /sys/class/gpio37/value Simply repeat the code for other gpios ...
djmcg Posted December 15, 2018 Author Posted December 15, 2018 Hi thanks for reply . Look`s like not work
martinayotte Posted December 15, 2018 Posted December 15, 2018 7 minutes ago, djmcg said: Look`s like not work Sorry, I did some typos, it should be : echo 37 > /sys/class/gpio/export echo "out" > /sys/class/gpio/gpio37/direction echo 1 > /sys/class/gpio/gpio37/value
djmcg Posted December 15, 2018 Author Posted December 15, 2018 OK thanks Turn on works, how to turn off
martinayotte Posted December 15, 2018 Posted December 15, 2018 2 minutes ago, djmcg said: Turn on works how to turn off Simple ... echo 0 > /sys/class/gpio/gpio37/value
djmcg Posted December 15, 2018 Author Posted December 15, 2018 8 minutes ago, martinayotte said: Simple ... echo 0 > /sys/class/gpio/gpio37/value Hello I just tested with parameter "0" not work, but echo 37 > /sys/class/gpio/export - init option to work (on ,off) echo "out" > /sys/class/gpio/gpio37/direction - turn On echo 1 > /sys/class/gpio/gpio37/value - turn Off Thank You
djmcg Posted December 15, 2018 Author Posted December 15, 2018 It `s somethin doing cracy now 0 work correctly
martinayotte Posted December 15, 2018 Posted December 15, 2018 6 minutes ago, djmcg said: now 0 work correctly Good ! Simple bash script to toogle every half seconds : #!/bin/bash echo 37 > /sys/class/gpio/export echo "out" > /sys/class/gpio/gpio37/direction while true; do echo 0 > /sys/class/gpio/gpio37/value sleep 0.5 echo 1 > /sys/class/gpio/gpio37/value sleep 0.5 done
djmcg Posted December 15, 2018 Author Posted December 15, 2018 Could You help me When i turn on/off the 37 port in gpio readall The port 31 is change Could You advice what`s happen see screen
martinayotte Posted December 15, 2018 Posted December 15, 2018 2 hours ago, djmcg said: The port 31 is change What do you means, there is no such pins for 31, neither than 29,33,35, gpio numbers are the ones in the BCM column ... So that is why sysfs gives errors. For "gpio readall" outputs, it is reflecting the reality when you change value of 37, the V columns is appearing accordingly...
Recommended Posts