当前位置:网站首页>Ardunio development - steering gear control
Ardunio development - steering gear control
2022-07-22 14:11:00 【The guest court carries the theory】
List of articles
Introduce
- Steering gear is a kind of driver that controls the motion state by input . The single chip microcomputer sends a signal to the steering gear , There is a reference circuit inside the steering gear , Generate a reference signal of a specific frequency , Compare the obtained bias voltage with the voltage of the potentiometer to obtain the voltage difference output . There is an integrated circuit on the circuit board to judge the rotation direction , Drive the coreless motor to start rotating , The power is transmitted to the swing arm through the reduction gear , Then the signal is sent back by the position detector , Determine whether the position has been reached . The angle range is 0 To 180 degree .
- The rotation angle of the steering gear is controlled by the pulse width , Pulse width by 0.5ms To 2.5ms Between , Pulse width and steering angle are 0° To 180° Corresponding .
- So there are two ways to control the steering gear
- Use ordinary digital sensor interface to generate square waves with different proportions , simulation PWM Signal for steering gear positioning
- Use Ardunio Of Servo Function to control the steering gear , Through digital interface 9 and 10 To drive .
- On the development board in the figure below wemos D1 On ,D1 To D8 All interfaces support PWM, Therefore, it can be specified as a specific port
Run the sample code
#include <Servo.h>
Servo myservo; // create servo object to control a servo
int potpin = 0; // analog pin used to connect the potentiometer
int val; // variable to read the value from the analog pin
void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop() {
val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180)
myservo.write(val); // sets the servo position according to the scaled value
delay(15); // waits for the servo to get there
}
Reference resources
https://docs.arduino.cc/learn/electronics/servo-motors
边栏推荐
- Easy gene | how to do the simplified genomic DNA methylation sequencing (RRBs) experiment?
- Seektiger's okaleido has a big move. Will the STI of ecological pass break out?
- OpenCV 常用的API总结(迅速查询)
- ABAP语法基础3
- ctf (套娃)
- Network metering - transport layer
- c语言:查漏补缺(二)
- 8.zabbix分布式
- Advanced C language: data storage (floating point)
- 【机器学习】机器学习中到底需不需要进行样本平衡
猜你喜欢
Looking for Fibonacci number
There are two key skills for high availability of microservices, which you must use
Pytorch(三)——FashionMNIST时装分类
Do you have to follow flush privileges after MySQL grant?
51单片机外设篇:LED点阵
Pads Sketchpad box
ASM学习系列(二)
Make a reliable delay queue with redis
Ardunio開發——水泵操作過程
Super dry! Thoroughly understand the differences and connections between simplex, half duplex and full duplex
随机推荐
el-tree树设置懒加载以及设置默认勾选
Network planning - application layer
To get a super practical small page - todollist
树莓派——云服务器部署——内网穿透——cpolar工具使用
08.Octave 语言的使用-控制语句、绘制图线和其他命令
The 22 pictures show you in-depth analysis of prefix, infix, suffix expressions and expression evaluation
ES6中 async 函数、await表达式
ctf (套娃)
通讯录(文件版本)
There are two key skills for high availability of microservices, which you must use
Concurrency opening -- take you from 0 to 1 to build the cornerstone of concurrency knowledge system
After reading this, I can't DVMA yet. Please eat melon
Cache and redirection in HTTP practice
Ardunio開發——水泵操作過程
Pytorch(三)——FashionMNIST时装分类
Daily question C language 9
从20s优化到500ms,我用了这三招
Kubernetes调度概念与工作流程
香港云服务器和物理服务器哪个更容易宕机?
Notes and Thoughts on the red dust of the curtain of Heaven (II) you know what others know and what you know