当前位置:网站首页>Analog rocker controlled steering gear
Analog rocker controlled steering gear
2022-07-04 22:39:00 【Let everything burn】
List of articles
Mission :
Potentiometer and steering gear combined application , If it is 180° The steering gear , The effective range of potentiometer is also 180°, If it is 90° The steering gear , The effective range of potentiometer is 90°, Potentiometer and steering gear angle position are synchronized , The effective starting point of potentiometer is self-determined , The finish for ( The starting point +90°/180°)
Ideas
The potentiometer on the yangtao development board is the omnidirectional rocker on the left , With rocker x Axis or y The axis controls the angle of the steering gear
For example, the rocker on the far left corresponds to the steering gear 0°, Pull to the rightmost steering gear and turn 180°
The angle of the steering gear is evenly distributed at the beginning and end of the rocker
The rocker is essentially an adjustable resistor , After the resistance voltage is divided, the single chip microcomputer can be used ADC Get location status
Completion code
int main (void){
// The main program
delay_ms(500); // Wait for other devices to be ready when powered on
RCC_Configuration(); // System clock initialization
TOUCH_KEY_Init();// Touch the button to initialize
RELAY_Init();// Relay initialization
TIM3_PWM_Init(59999,23);
ADC_Configuration(); //ADC Initialize settings ( Simulate the of the rocker ADC initialization )
JoyStick_Init(); // Simulate the key initialization of the rocker
I2C_Configuration();//I2C initialization
OLED0561_Init(); //OLED initialization
OLED_DISPLAY_8x16_BUFFER(0," YoungTalk "); // display string
OLED_DISPLAY_8x16_BUFFER(2," ADC TEST "); // display string
OLED_DISPLAY_8x16_BUFFER(4," ADC_IN6: "); // display string
OLED_DISPLAY_8x16_BUFFER(6," ADC_IN7: "); // display string
while(1){
// Turn the of the photoresist ADC The data is shown in OLED On
OLED_DISPLAY_8x16(4,10*8,ADC_DMA_IN[0]/1000+0x30);//
OLED_DISPLAY_8x16(4,11*8,ADC_DMA_IN[0]%1000/100+0x30);//
OLED_DISPLAY_8x16(4,12*8,ADC_DMA_IN[0]%100/10+0x30);//
OLED_DISPLAY_8x16(4,13*8,ADC_DMA_IN[0]%10+0x30);//
OLED_DISPLAY_8x16(6,10*8,ADC_DMA_IN[1]/1000+0x30);//
OLED_DISPLAY_8x16(6,11*8,ADC_DMA_IN[1]%1000/100+0x30);//
OLED_DISPLAY_8x16(6,12*8,ADC_DMA_IN[1]%100/10+0x30);//
OLED_DISPLAY_8x16(6,13*8,ADC_DMA_IN[1]%10+0x30);//
// Method 1 : Inter partition control ( Simple but troublesome )
// if(ADC_DMA_IN[0]<100)
// TIM_SetCompare3(TIM3,1500);
//
// if(ADC_DMA_IN[0]>=100&&ADC_DMA_IN[0]<1700)
// TIM_SetCompare3(TIM3,ADC_DMA_IN[0]+1500);
// if(ADC_DMA_IN[0]>=1700&&ADC_DMA_IN[0]<2000)
// TIM_SetCompare3(TIM3,ADC_DMA_IN[0]+2300);
//
// if( ADC_DMA_IN[0]>=2000&&ADC_DMA_IN[0]<3500)
// TIM_SetCompare3(TIM3,ADC_DMA_IN[0]+2500);
// if( ADC_DMA_IN[0]>=3500&&ADC_DMA_IN[0]<4000)
// TIM_SetCompare3(TIM3,ADC_DMA_IN[0]+3500);
//
// if( ADC_DMA_IN[0]>4000)
// TIM_SetCompare3(TIM3,7500);
// delay_ms(10);
// Method 2 : Write formula conversion ( Difficult but convenient )
TIM_SetCompare3(TIM3,ADC_DMA_IN[0]*(3.3/4096)*1820+1500);
if(GPIO_ReadInputDataBit(JoyStickPORT,JoyStick_KEY)==0){
OLED_DISPLAY_8x16(0,0,'Y');//
}else{
OLED_DISPLAY_8x16(0,0,' ');//
}
delay_ms(200); // Time delay
}
}
边栏推荐
- PostgreSQL服务端编程聚合和分组
- Close system call analysis - Performance Optimization
- Microservices -- Opening
- Alibaba launched a new brand "Lingyang" and is committed to becoming a "digital leader"
- Google Earth Engine(GEE)——基于 MCD64A1 的 GlobFire 日常火灾数据集
- 质量体系建设之路的分分合合
- 不同环境相同配置项的内容如何diff差异?
- NFT Insider #64:电商巨头eBay提交NFT相关商标申请,毕马威将在Web3和元宇宙中投入3000万美元
- 业务太忙,真的是没时间搞自动化理由吗?
- 微服务--开篇
猜你喜欢
Nat. Commun.| Machine learning jointly optimizes the affinity and specificity of mutagenic therapeutic antibodies
傳智教育|如何轉行互聯網高薪崗比特之一的軟件測試?(附軟件測試學習路線圖)
攻防世界 MISC 进阶 glance-50
Concurrent optimization summary
LOGO特训营 第四节 字体设计的重要性
More than 30 institutions jointly launched the digital collection industry initiative. How will it move forward in the future?
Attack and defense world misc advanced area ditf
Wake up day, how do I step by step towards the road of software testing
LOGO特训营 第三节 首字母创意手法
Éducation à la transmission du savoir | Comment passer à un test logiciel pour l'un des postes les mieux rémunérés sur Internet? (joindre la Feuille de route pour l'apprentissage des tests logiciels)
随机推荐
LOGO special training camp section I identification logo and Logo Design Ideas
面试必备 LeetCode 链表算法题汇总,全程干货!
高中物理:直线运动
阿里推出新品牌“瓴羊”,致力成为“数字化领头羊”
Domestic database chaos
华泰证券是国家认可的券商吗?开户安不安全?
Attack and Defense World MISC Advanced Area Erik baleog and Olaf
Now MySQL cdc2.1 is parsing the datetime class with a value of 0000-00-00 00:00:00
攻防世界 MISC 進階區 Erik-Baleog-and-Olaf
虚拟人产业面临的挑战
Hit the core in the advanced area of misc in the attack and defense world
Locust performance test - environment construction and use
PMO: compare the sample efficiency of 25 molecular optimization methods
我在linux里面 通过调用odspcmd 查询数据库信息 怎么静默输出 就是只输出值 不要这个
不同环境相同配置项的内容如何diff差异?
The proofreading activity of data science on the command line second edition was restarted
NFT Insider #64:电商巨头eBay提交NFT相关商标申请,毕马威将在Web3和元宇宙中投入3000万美元
2022-07-04:以下go语言代码输出什么?A:true;B:false;C:编译错误。 package main import “fmt“ func main() { fmt.Pri
LOGO特訓營 第一節 鑒別Logo與Logo設計思路
【OpenGL】笔记二十九、抗锯齿(MSAA)