当前位置:网站首页>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

边栏推荐
- Stm32f407 ------- DSP learning
- Intelligent industrial design software company Tianfu C round financing of hundreds of millions of yuan
- 从硬件编程到软件平台的ci/cd
- 蓝桥杯原题
- style=“width: ___“ VS width=“___“
- Exness: Japanese prices rose and incomes fell, with the pound / yen breaking 165
- Thread Foundation
- 工程电磁场复习基本知识点
- 小程序已获取数据库合集中的总记录、用户位置,怎么用Aggregate.geoNear将经纬度由近到远排列?
- ELS displays a random square
猜你喜欢

stm32F407-------FPU学习

Decision tree and random forest learning notes (1)

Day 19 of leetcode

【下载文件】uniapp开发小程序,下载文件并保存到本地

行业洞察 | 语音识别真的超过人耳朵了吗?

Unexpected harvest of epic distributed resources, from basic to advanced are full of dry goods, big guys are strong!

Which of the four solutions of distributed session do you think is the best?

Comprehensive case

树莓派开发继电器控制灯

满满干货赶紧进来!!!轻松掌握C语言中的函数
随机推荐
MySQL索引学习
Qt官方示例:Fridge Magnets Example(冰箱贴)
决策树与随机森林学习笔记(1)
QT topic 1: implementing a simple calculator
Tungsten Fabric SDN — BGP as a Service
Data Lake: flume, a massive log collection engine
【uni-app高级实战】手把手带你学习一个纯实战复杂项目的开发2/100
[QNX hypervisor 2.2 user manual]9.10 pass
蓝桥杯:第九届—“彩灯控制器”
行业洞察 | 语音识别真的超过人耳朵了吗?
注意,这些地区不能参加7月NPDP考试
C#中关闭窗体的四种方法
Development and design logic of rtsp/onvif protocol easynvr video platform one click upgrade scheme
Yiwen teaches you to distinguish between continuous integration, continuous delivery and continuous deployment
Distributed transaction Senta (I)
基于JSP&Servlet实现的众筹平台系统
Docker advanced -redis cluster configuration in docker container
[2022 Niuke multi school 2 K link with bracket sequence I] bracket linear DP
42.js -- precompiled
汇总了50多场面试,4-6月面经笔记和详解(含核心考点及6家大厂)