当前位置:网站首页>迅为IMX6ULL开发板C程序调用shell
迅为IMX6ULL开发板C程序调用shell
2020-11-09 19:13:00 【书白】
本章节介绍的是在 linux 系统环境下 linux-C 调用 shell 命令控制GPIO输入输出步骤。shell 作为Linux 操作系统的外壳,为用户提供使用操作系统的接口。它是命令语言、命令解释程序及程序设计语言的统称,它解释由用户输入的命令并且把它们送到内核。
使用shell命令直接操作/sys/下的gpio节点,首先在imx6ull-14x14-evk.dts注释掉设备树的 LED和按键功能,LED引脚为GPIO0_3,key引脚为GPIO1_18。
在程序中通过shell命令读取按键值和控制LED灯。
1.通过popen执行shell命令
popen和pclose函数实现的功能是创建一个管道,用来连接到另一个进程,然后读那个进程的输出或向它发送输入,具体操作是fork一个子进程,exec一个shell执行命令。
2.填写shell命令,设置引脚状态
3.控制Led
交叉编译arm-linux-gnueabihf-gcc -o led shellGpio.c ,将led文件拷贝到开发板。
测试可看到开发板的灯在闪烁,终端有打印信息:
4.读取按键值
编译后测试:
好物推荐-迅为品质IMX6ULL开发板
终结者资料全开源,不买也可以自由下载软硬件资源
您只需要关注VX公众号:迅为电子 , 回复 :终结者,免费获取产品资料
i.MX6ULL终结者手册下载链接
https://pan.baidu.com/s/171NHz6_sVMGIQ3g7GcCqOQ 提取码:n3og
B站搜‘北京迅为’, 入门视频教程免费学习,持续更新。
https://space.bilibili.com/33785640
i.MX6ULL终结者开发板介绍
https://www.bilibili.com/video/BV1aE411F7S9
i.MX6ULL终结者开发板开箱初体验
https://www.bilibili.com/video/BV1M7411m7wT
Linux-QT教程可在此免费观看,迅为率先提供6ULL的QT视频实战教程,尝鲜版:
本期QT视频将会收获哪些知识?
https://www.bilibili.com/video/BV1tp4y1i7EJ?p=1
P10 QT上位机开发之串口助手(上)
https://www.bilibili.com/video/BV1tp4y1i7EJ?p=10
QT网络编程之UDP通信
https://www.bilibili.com/video/BV1tp4y1i7EJ?p=14
QT系统移植之交叉编译QT源码和触摸源码
https://www.bilibili.com/video/BV1tp4y1i7EJ?p=17
QT跨平台运行之把QT程序交叉编译到ARM开发板
https://www.bilibili.com/video/BV1tp4y1i7EJ?p=19
QT跨平台运行之使用QT控制蜂鸣器
https://www.bilibili.com/video/BV1tp4y1i7EJ?p=20
QT跨平台运行之把QT程序编译成手机APP
https://www.bilibili.com/video/BV1tp4y1i7EJ?p=21
仿写一个智能家居界面(上)
https://www.bilibili.com/video/BV1tp4y1i7EJ?p=7
仿写一个智能家居界面(下)
https://www.bilibili.com/video/BV1tp4y1i7EJ?p=9
版权声明
本文为[书白]所创,转载请带上原文链接,感谢
https://my.oschina.net/u/3005926/blog/4710053
边栏推荐
- What is the Ethernet module? What are the functions and characteristics of the Ethernet module
- (3) ASP.NET Core3.1 Ocelot certification
- 分享用MathType编辑字母与数学公式的技巧
- RBAC of kubernetes authority management (1)
- 浅谈API网关(API Gateway)如何承载API经济生态链
- 手势切换背景,让直播带货更加身临其境
- Configure static IP address in ubuntu18.04 NAT mode -2020.11.09
- How to use RTSP streaming component easypusher to push MP4 files to easydarwin open source platform?
- ABBYY FineReader 15新增编辑页面布局功能
- 谷粒商城学习笔记,第五天:ES全文检索
猜你喜欢
iOS下带小数点的数字键盘
都要2021年了,现代C++有什么值得我们学习的?
Android软键盘遮挡的四种解决方案
Hand in hand to teach you to use container service tke cluster audit troubleshooting
Git + -- Code hosting in the history of version management
C console calls ffmpeg to push MP4 video file to stream media open source service platform easydarwin process
解决微信小程序使用switchTab跳转后页面不刷新的问题
A great guide to curl
Share tips on editing letters and mathematical formulas with MathType
Custom indoor map online tool
随机推荐
C console calls ffmpeg to push MP4 video file to stream media open source service platform easydarwin process
C#控制台调用FFMPEG推MP4视频文件至流媒体开源服务平台EasyDarwin过程
dat.GUI 打造可视化工具(一)
ABBYY FineReader 15 新增编辑表格单元格功能
High performance library dpdk concise understanding
Single linked list inversion
[stm32h7] Chapter 6: stm32h7 dma2d acceleration of ThreadX guix
Container technology (3) mirror summary [16]
Centos7下基于Pseudo-Distributed的Hadoop环境搭建
Mit6.824 distributed system course translation & learning notes (3) GFS
Exhibition cloud technology interpretation | in the face of emergencies, how does app do a good job in crash analysis and performance monitoring?
数据库执行truncate table CM_CHECK_ITEM_HIS怎么恢复
Mongodb source code implementation series network transport layer module implementation 3
The applet calls the native onshareappmessage to share. What if the imageurl parameter is in MP4 format
【云小课】版本管理发展史之Git+——代码托管
容器技术(三)搭建本地 Registry【15】
A practical chrome Gadget: xtrace
openocd+jlink_picture
Ubuntu18.04 NAT模式下配置静态IP地址 -2020.11.09
js对象数组去重