当前位置:网站首页>Infrared sensor control switch
Infrared sensor control switch
2022-04-23 07:22:00 【Lin Jinpeng】
One 、 Results the preview
Infrared sensor control switch
Two 、 Implementation process
# -*- coding: utf-8 -*-
import RPi.GPIO as GPIO
# Use actual physical pins to GPIO mouth
GPIO.setmode(GPIO.BOARD)
# Set the pin to input mode , Pull up to high level (3.3V)
GPIO.setup(11, GPIO.IN, pull_up_down=GPIO.PUD_UP)
# LED Pin settings
# Set up Pin The mode is output mode
GPIO.setup(12, GPIO.OUT)
# Set up Pin The pin is low level (0V) close LED
GPIO.output(12, GPIO.LOW)
# Set the frequency to 2KHz
Led = GPIO.PWM(12, 2000)
Led.start(0)
# Infinite loop
def loop():
while True:
if (0 == GPIO.input(11)):
# Appear barrier , Light up
Led.ChangeDutyCycle(100.0)
else:
# Remove barriers , Turn off the lights
Led.start(0)
# Program entrance
if __name__ == '__main__':
try:
# Infinite loop
loop()
# When pressed Ctrl+C when , Will perform destroy() Subroutines
except KeyboardInterrupt:
# Call to release resources
GPIO.cleanup()
版权声明
本文为[Lin Jinpeng]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230609472992.html
边栏推荐
- 【点云系列】Neural Opacity Point Cloud(NOPC)
- What did you do during the internship
- [3D shape reconstruction series] implicit functions in feature space for 3D shape reconstruction and completion
- Record WebView shows another empty pit
- 【点云系列】Unsupervised Multi-Task Feature Learning on Point Clouds
- Binder mechanism principle
- Chapter 3 pytoch neural network toolbox
- Summary of image classification white box anti attack technology
- [recommendation of new books in 2021] practical IOT hacking
- 微信小程序 使用wxml2canvas插件生成图片部分问题记录
猜你喜欢
PyMySQL连接数据库
机器学习——PCA与LDA
第2章 Pytorch基础2
【点云系列】Unsupervised Multi-Task Feature Learning on Point Clouds
[point cloud series] sg-gan: advantageous self attention GCN for point cloud topological parts generation
Chapter 4 pytoch data processing toolbox
【点云系列】Learning Representations and Generative Models for 3D pointclouds
[2021 book recommendation] red hat rhcsa 8 cert Guide: ex200
[recommendation for new books in 2021] professional azure SQL managed database administration
[2021 book recommendation] learn winui 3.0
随机推荐
第3章 Pytorch神经网络工具箱
Keras如何保存、加载Keras模型
Gobang games
【点云系列】Pointfilter: Point Cloud Filtering via Encoder-Decoder Modeling
[point cloud series] pnp-3d: a plug and play for 3D point clouds
Chapter 5 fundamentals of machine learning
ArcGIS license server administrator cannot start the workaround
【点云系列】FoldingNet:Point Cloud Auto encoder via Deep Grid Deformation
GEE配置本地开发环境
第2章 Pytorch基础2
【点云系列】 A Rotation-Invariant Framework for Deep Point Cloud Analysis
MySQL的安装与配置——详细教程
MySQL notes 1_ database
Gephi tutorial [1] installation
Component based learning (3) path and group annotations in arouter
Fill the network gap
【3D形状重建系列】Implicit Functions in Feature Space for 3D Shape Reconstruction and Completion
【点云系列】Neural Opacity Point Cloud(NOPC)
[2021 book recommendation] artistic intelligence for IOT Cookbook
How keras saves and loads the keras model