当前位置:网站首页>Raspberry pie development relay control lamp
Raspberry pie development relay control lamp
2022-07-28 03:15:00 【Ten years moo a sword】
Relay wiring

Relay principle : Give a high level NO--->COM otherwise NO---X---COM
Raspberry pie io chart

Relay com and vcc Pick up 3.3 That's it
Ensure that the power supply connected to the module is the same
Code
#include <stdio.h>
#include <wiringPi.h>
#define INOUT GPIO 7
int main()
{
int cmd;
/* Initialize judgment */
if (wiringPiSetup()==-1){
printf(" Initial failure !n"):
return -2;
}
/* Mode selection */
pinMode (INOUT GPIO,OUTPUT);
/* The output is set high and does not engage */
digitalWrite(INOUT GPIO,HIGH);
while(1){
printf("0 break >>>><く<1 through \n")
scanf(" Number d",&cmd);
getchar();// Complete an output and finally wrap
/* Get 1 Imbibition */
if (cmd==1){
digitalWrite (INOUT GPIO,LOW);
}
/* Get 0 Nonabsorbent */
else if (cmd==0){
digitalwrite(INOUT GPIO,HIGH);
}
/* Nothing returned -1*/
else return -1;
}
return 0;
}

From the keyboard obtain To 0 clone ssh page see The state of the output
Get 0 Output 1
gpio raedall View pin distribution and status

边栏推荐
- Unexpected harvest of epic distributed resources, from basic to advanced are full of dry goods, big guys are strong!
- NPDP考生!7月31号考试要求在这里看!
- RBD块存储设备的扩容以及缩容操作(六)
- 线程基础
- Is the securities account given by qiniu safe? Can qiniu open an account and buy funds
- 为什么登录时,明明使用的是数据库里已经有的账号信息,但依旧显示“用户不存在”?
- QT专题1:实现一个简易计算器
- 42.js -- precompiled
- WEB安全基础 - - -命令执行漏洞
- OA项目之我的审批(会议查询&会议签字)
猜你喜欢

Day 19 of leetcode

Development and design logic of rtsp/onvif protocol easynvr video platform one click upgrade scheme

满满干货赶紧进来!!!轻松掌握C语言中的函数

On weight decay and discarding method

QML使用Layout布局时出现大量<Unknown File>: QML QQuickLayoutAttached: Binding loop detected for property循环绑定警告

OA项目之我的审批(会议查询&会议签字)

Actual case of ROS communication

工程电磁场复习基本知识点

数据湖:海量日志采集引擎Flume

《MySQL数据库进阶实战》读后感(SQL 小虚竹)
随机推荐
上位机与MES对接的几种方式
clientY vs pageY
阿里云国际版邮件服务套餐购买流程
style=“width: ___“ VS width=“___“
mysql 随笔
Which of the four solutions of distributed session do you think is the best?
JVM 内存布局详解,图文并茂,写得太好了!
Scheme sharing | experts gather to jointly explore accent AI speech recognition
STM32之IO模拟串口篇
【ACwing 1064 小国王】状压dp
数据湖:海量日志采集引擎Flume
【2022 牛客第二场J题 Link with Arithmetic Progression】三分套三分/三分极值/线性方程拟合最小二乘法
基于OpenCV的轮廓检测(3)
机器人工程是否有红利期
stm32F407-------FPU学习
Where do I go to open an account for stock speculation? Is it safe to open an account on my mobile phone
会议OA项目之我的审批&&签字功能
【类的本质(Objective-C语言中)】
els 键盘信息
综合 案例