In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the raspberry pie how to connect the relay, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, let the editor take you to know it.
Prepare materials
Zero wh for raspberry pie.
One relay (model JQC-3FF-S-Z)
Disassembled USB cabl
LED lamp
The relay is connected to the raspberry pie line
Relay VCC connects to raspberry pie 5v5
Relay GND connects to raspberry pie GND
Relay IN connects to raspberry pie GPIO18
Pay attention to distinguish between VCC and GND, do not connect backwards!
Relay, LED lamp and power line connection
Relay NO connected to LED positive electrode
Relay COM connected to positive pole of power supply
LED negative electrode connected to power supply negative electrode
As shown in the following figure
Physical connection diagram
The code runs vim jdq.py
Write the following
#-*-coding: utf-8-*-import RPi.GPIO as GPIOimport time # BCM numbering mode GPIO.setmode (GPIO.BCM) # set [GPIO port with BCM number 18] as output mode GPIO.setup (18, GPIO.OUT) # enable GPIO.output (18, GPIO.HIGH) time.sleep (5) # close GPIO.output (18, GPIO.LOW) GPIO.cleanup ()
Execute jdq.py code
Python3 jdq.py
When you hear a click, the LED light will be on, and when you hear the click, the LED light will go out.
Knowledge expansion
Relay schematic diagram
Thank you for reading this article carefully. I hope the article "how to connect relays with raspberry pie" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.