Set GPIO remotely

元气小坏坏 提交于 2019-12-12 04:29:30

问题


I haven't tried this yet but I don't think I can use NFS to set /sys/class/gpio/gpio48/value remotely on a beaglebone. I think I read you could do this a different way but I would really like to write to a file on remote server and have it set /sys/class/gpio/gpio48/value locally on beaglebone. I don't know how to link these two files up. I am using java to program but I don't think that should make a big difference.

Using BeagleBone Black GPIOs


回答1:


Not sure if NFS will work this way to but I was able to set the value of /sys/class/gpio/gpio48/value remotely using sshfs. Anyone interested in doing to same install sshfs on both host linux machine and beaglebone. From beaglebone ssh -R 2000:localhost:22 root@<pc ipaddress maybe 192.168.7.1 or 192.168.7.3>. From host linux machine after ssh into it from beaglebone mkdir /mnt/remoteBB; sshfs -p2000 -o allow_other root@localhost:/ /mnt/remoteBB/. You can then set the value file.

Example workflow

On beaglebone:

[root@alarm ~]# cat /sys/class/gpio/gpio48/value 1

On host linux machine

root@scw-27ca2d:~# cat /mnt/remoteBB/sys/class/gpio/gpio48/value 1 root@scw-27ca2d:~# echo 0 > /mnt/remoteBB/sys/class/gpio/gpio48/value root@scw-27ca2d:~# cat /mnt/remoteBB/sys/class/gpio/gpio48/value 0

On beaglebone:

[root@alarm ~]# cat /sys/class/gpio/gpio48/value 0

Cheers!



来源:https://stackoverflow.com/questions/36846574/set-gpio-remotely

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!