当前位置:网站首页>迅为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
边栏推荐
- The applet calls the native onshareappmessage to share. What if the imageurl parameter is in MP4 format
- js对象数组去重
- [interview experience] bat programmers interviewed 200 people and analyzed the most frequently asked interview questions
- 【STM32F429】第6章 ThreadX GUIX上手之STM32F429 DMA2D加速
- 企业公司开发微信小程序适用于哪些行业?
- 第三阶段 Day19 用户回显 封装Cookie 商品远程调用 购物车模块 CRUD操作
- High performance library dpdk concise understanding
- Centos7下基于Pseudo-Distributed的Hadoop环境搭建
- [graffiti Internet of things footprint] graffiti cloud platform interface description
- LeetCode 48 旋转图像
猜你喜欢
![[interview experience] bat programmers interviewed 200 people and analyzed the most frequently asked interview questions](/img/ab/b8a437d045d422a6a5c75fa4cc9dee.jpg)
[interview experience] bat programmers interviewed 200 people and analyzed the most frequently asked interview questions
![[graffiti Internet of things footprint] graffiti cloud platform interface description](/img/f9/521c69fed884058e3800af0ea06bc0.jpg)
[graffiti Internet of things footprint] graffiti cloud platform interface description

Day83: Luffy: add shopping cart & navigation bar shopping cart digital display & shopping cart page display

Hand in hand to teach you to use container service tke cluster audit troubleshooting

Numeric keyboard with decimal point in IOS

【STM32H7】第6章 ThreadX GUIX上手之STM32H7 DMA2D加速

第三阶段 Day19 用户回显 封装Cookie 商品远程调用 购物车模块 CRUD操作

In the third stage, day19 users echo packaged cookie products and remotely call Shopping Cart module crud operation

Super low price cloud server is coming

RBAC of kubernetes authority management (1)
随机推荐
Git老鸟查询手册
How to implement a simple student management system with C + +
iOS下带小数点的数字键盘
Flink的安装部署
Revealing the logic of moving path selection in Summoner Canyon?
Super low price cloud server is coming
Configure static IP address in ubuntu18.04 NAT mode -2020.11.09
Learning notes of millet mall, day 5: ES full text search
Installation and deployment of Flink
Day83: Luffy: add shopping cart & navigation bar shopping cart digital display & shopping cart page display
Mit6.824 distributed system course translation & learning notes (3) GFS
Experts' interpretation of four hot industries in 2020 China telecom terminal technology and Standards Forum
The basic principle of MRAM
openocd+jlink_picture
高性能库DPDK精简理解
Exhibition cloud technology interpretation | in the face of emergencies, how does app do a good job in crash analysis and performance monitoring?
From Silicon Valley to Xiaomi, Cui Baoqiu's 25 years of open source life
LeetCode 48 旋转图像
超简单集成华为系统完整性检测,搞定设备安全防护
Almost finished all the list titles, I found these things...