当前位置:网站首页>智能垃圾桶(七)——SG90舵机的介绍与使用(树莓派pico实现)
智能垃圾桶(七)——SG90舵机的介绍与使用(树莓派pico实现)
2022-07-28 21:53:00 【光追雨】
一、SG90舵机的引脚介绍
舵机上会引出三根线:分别是GND(棕色线)、VCC(红色线)和SIG(黄色线),就是地线、电源线(5V)和信号线。千万不能接错!

二、与pico引脚的对接

黄色(数据线) —>GPIO0
棕色(底线GND) —>VBUS
红色(电源线VCC) —>GND
三、舵机的使用原理
1638-8192(0-180)
sg90原理:在50hz频率下周期为20ms
t = 0.5ms——————-舵机会转动 0 °
t = 1.0ms——————-舵机会转动 45°
t = 1.5ms——————-舵机会转动 90°
t = 2.0ms——————-舵机会转动 135°
t = 2.5ms——————-舵机会转动180°
duty_u16计算方法,90度时候65532*1.5/20得到的值,
四、Thonny程序
from machine import PWM,Pin
import utime
s = PWM(Pin(0))
s.freq(50)
s.duty_u16(4915) # 4915是90度
utime.sleep(2)
s.duty_u16(8192) # 8192是180度
utime.sleep(2)
s.duty_u16(1638) # 1638是0度
五、效果展示

边栏推荐
- MySQL functions
- 使用这个,你发的消息就无法被监控了
- 金仓数据库 KingbaseES与Oracle的兼容性说明(2. 数据类型)
- 解决线程安全问题&&单例模式
- Runloop principle (II)
- 【自】-刷题-逻辑
- How to open a profitable gym? I tell you from one year's experience that don't fall in love
- Intel data center GPU is officially shipped to provide strong computing power with openness and flexibility
- 苹果官网正在更新维护 Apple Store,国行 iPhone 13 / Pro 等产品将最高优惠 600 元
- 酒店预订系统数据库房间库存设计思路
猜你喜欢

Runloop principle (II)

互动滑轨屏在展厅中应用的制作步骤

A new generation of ultra safe cellular battery, Sihao aipao, will be available from 139900 yuan

如何开一家盈利的健身房?我用1年回本的经验告诉你,别谈恋爱

Pin mapping relationship of stm32f103c series single chip microcomputer under Arduino framework

字节8年女测试总监工作感悟—写给想转行或即将进入测试行业的女生们...

Optimization and implementation of custom MVC

Asynchronism and synchronization of visa write and read functions by LabVIEW

使用这个,你发的消息就无法被监控了

集火全屋智能“后装市场”,真正玩得转的没几个
随机推荐
猿人学第二十题
编译原理研究性学习专题 2——递归下降语法分析设计原理与实现
被忽视的智能电视小程序领域
CV实例分割模型小抄(1)
What is utxo?
字节8年女测试总监工作感悟—写给想转行或即将进入测试行业的女生们...
【自】-刷题-逻辑
【自】-刷题-字符串
[self] - brush questions array
CV语义分割模型小抄(2)
Few people can really play in the "aftermarket" of the whole house intelligent fire collection
CV目标检测模型小抄(2)
Arduino uno driver universe 1.8 'TFT SPI screen example demonstration (including data package)
浪潮ClusterEngineV4.0 远程命令执行漏洞 CVE-2020-21224
Crud of MySQL
What if win11 quick copy and paste cannot be used? Win11 shortcut copy and paste cannot be used
Development of small programs ②
Custom MVC principle and framework
Runloop principle (II)
22 Niuke multi school Day1 I - Introduction to chiitoitsu DP