树莓派php控制gpio,使用Linux命令控制树莓派GPIO接口

root@raspberrypi:/sys/class/gpio# echo 20 > export

root@raspberrypi:/sys/class/gpio# l

total 0

drwxrwx--- 2 root gpio 0 Mar 18 17:00 .

drwxr-xr-x 46 root root 0 Mar 18 16:53 ..

-rwxrwx--- 1 root gpio 4.0K Mar 18 17:00 export

lrwxrwxrwx 1 root gpio 0 Mar 18 17:00 gpio20 -> ../../devices/soc/3f200000.gpio/gpio/gpio20

lrwxrwxrwx 1 root gpio 0 Jan 1 1970 gpiochip0 -> ../../devices/soc/3f200000.gpio/gpio/gpiochip0

-rwxrwx--- 1 root gpio 4.0K Jan 1 1970 unexport

root@raspberrypi:/sys/class/gpio# l gpio20

lrwxrwxrwx 1 root gpio 0 Mar 18 17:00 gpio20 -> ../../devices/soc/3f200000.gpio/gpio/gpio20

root@raspberrypi:/sys/class/gpio# cd gpio20

root@raspberrypi:/sys/class/gpio/gpio20# l

total 0

drwxrwx--- 3 root gpio 0 Mar 18 17:00 .

drwxrwx--- 4 root gpio 0 Mar 18 17:00 ..

-rwxrwx--- 1 root gpio 4.0K Mar 18 17:00 active_low

lrwxrwxrwx 1 root gpio 0 Mar 18 17:00 device -> ../../../3f200000.gpio

-rwxrwx--- 1 root gpio 4.0K Mar 18 17:00 direction

-rwxrwx--- 1 root gpio 4.0K Mar 18 17:00 edge

drwxrwx--- 2 root gpio 0 Mar 18 17:00 power

lrwxrwxrwx 1 root gpio 0 Mar 18 17:00 subsystem -> ../../../../../class/gpio

-rwxrwx--- 1 root gpio 4.0K Mar 18 17:00 uevent

-rwxrwx--- 1 root gpio 4.0K Mar 18 17:00 value

root@raspberrypi:/sys/class/gpio/gpio20# cd ..

root@raspberrypi:/sys/class/gpio# echo out > gpio20/direction

root@raspberrypi:/sys/class/gpio# echo 1 > gpio20/value

root@raspberrypi:/sys/class/gpio# echo 0 > gpio20/value

root@raspberrypi:/sys/class/gpio# echo 20 > unexport

root@raspberrypi:/sys/class/gpio# l

total 0

drwxrwx--- 2 root gpio 0 Mar 18 17:03 .

drwxr-xr-x 46 root root 0 Mar 18 16:53 ..

-rwxrwx--- 1 root gpio 4.0K Mar 18 17:00 export

lrwxrwxrwx 1 root gpio 0 Jan 1 1970 gpiochip0 -> ../../devices/soc/3f200000.gpio/gpio/gpiochip0

-rwxrwx--- 1 root gpio 4.0K Mar 18 17:03 unexport

root@raspberrypi:/sys/class/gpio#

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值