当前位置:网站首页>迅为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
边栏推荐
- Flink的安装部署
- Android软键盘遮挡的四种解决方案
- R8 编译器: 为 Kotlin 库和应用 '瘦身'
- Using powerful powerbi Sangji diagram to express complex operation business flow
- 【面试经验】BAT程序员面试200人,常见最常问的面试问题做出解析
- Solve the problem that the page does not refresh after the wechat applet uses switchtab to jump
- iOS下带小数点的数字键盘
- js对象数组去重
- Four solutions of Android soft keyboard occlusion
- R8 compiler: tailoring kotlin libraries and Applications
猜你喜欢
OpenOCD-JTAG调试
零基础小白python入门——深入Python中的文件操作
又一道比较运算符相关的面试题让我明白基础很重要
电商/直播速看!双11跑赢李佳琦就看这款单品了!
Ultra simple integration of Huawei system integrity testing, complete equipment security protection
CentOS view the number of CPU cores and cpuinfo analysis
Rookie gospel, 28 books step by step to make you a big bull! (a copy of learning syllabus attached)
2020中国电信终端技术与标准论坛上专家解读四大热门产业
说说 C# 9 新特性的实际运用
How important these built-in icons are to easily build a high profile application interface!
随机推荐
如何运用二分查找算法
OpenOCD-JTAG调试
一个实用的Chrome小工具:xTrace
EasyExcel根据筛选列导出(中间不空列,顺序可调整)
[graffiti Internet of things footprint] graffiti cloud platform interface description
[interview experience] bat programmers interviewed 200 people and analyzed the most frequently asked interview questions
Single linked list inversion
高性能库DPDK精简理解
【神级操作】 以中国传统的孔子和老子的思想,来分析忍者代码!
How to edit summation formula in MathType
What is the Ethernet module? What are the functions and characteristics of the Ethernet module
Gesture switch background, let live with goods more immersive
数据库执行truncate table CM_CHECK_ITEM_HIS怎么恢复
又一道比较运算符相关的面试题让我明白基础很重要
浅谈API网关(API Gateway)如何承载API经济生态链
How to use RTSP streaming component easypusher to push MP4 files to easydarwin open source platform?
浅谈API网关(API Gateway)如何承载API经济生态链
In the third stage, the day20 Shopping Cart module is added, the interceptor is added, the user authority is checked, and the order module is realized
Rabbitmq installation
Function calculation advanced IP query tool development