GPIO编程在C树莓派
GPIO programming in C for raspberry PI
我有一个GPIO程序在python ..有没有人可以帮助我获得等效的C或c++程序在树莓派上运行。
python代码
import RPi.GPIO as GPIO
import time
# blinking function
def blink(pin):
GPIO.output(pin,GPIO.HIGH)
time.sleep(1)
GPIO.output(pin,GPIO.LOW)
time.sleep(1)
return
# to use Raspberry Pi board pin numbers
GPIO.setmode(GPIO.BOARD)
# set up GPIO output channel
GPIO.setup(11, GPIO.OUT)
# blink GPIO17 50 times
for i in range(0,50):
blink(11)
GPIO.cleanup()
提前感谢!:)
#include <header.h> // which contatining some delay function
void blink(int pin)
{
//Program the pin (which GPIO) to high
//delay function
//Program the pin (which GPIO) to low
//delay
return 0;
}
main()
{
// to use Raspberry Pi board pin numbers
GPIO.setmode(GPIO.BOARD) //check this fun def and find out what it is doing and code it accordingly
// set up GPIO 11 as output channel
// blink GPIO11 50 times
for(i=0;i<50;i++)
blink(11);
GPIO.cleanup() ////check this fun def and find out what it is doing and code it
相关文章:
- 有一个打印语句的函数是一种糟糕的编程实践吗
- 我是C++编程的新手,这些代码之间有什么区别,我应该使用哪一个
- 模板元编程:如何将参数包组合成新的参数包
- Qt Q串行端口未编程设备未关闭
- 模板元编程 - 尝试实现维度分析
- 我是编程新手
- C++编程从外部文本文件定义数组大小
- 了解算法的性能差异(如果以不同的编程语言实现)
- 使用 Gtkmm 以编程方式选择 Gtk::TextView 中的文本
- 如何将可变参数模板转换为多个单个模板?(C++竞争编程调试模板)
- 使用命名空间正确编程
- C++编程:运算符重载中的引用如何工作?
- Arduino 模块化编程与全局和设置
- C++ 运算符修改/元编程策略,用于不那么冗长的语法
- 在没有管理员权限的情况下,在 c++ 中以编程方式将程序添加到启动
- 如何以编程方式将音频从任何录制设备路由到任何播放设备
- 试图修复一个错误,该错误不会让我开始编程其余部分
- C++模板编程设计问题 - 根据输入文件返回不同的类型
- 在FriendlyARM板mini2440中编程GPIO的最佳方式是什么
- GPIO编程在C树莓派