📄 motor.h
字号:
#ifndef __motor_H__
#define __motor_H__ 1
extern volatile uint8 flag; //电机状态
//PB1,PB2 电机方向控制 电机左
#define motol_en1 PORTB |= 0x02
#define motol_en2 PORTB |= 0x04
#define motol_uen1 PORTB &=~ 0x02
#define motol_uen2 PORTB &=~ 0x04
//PB4,PB5 电机方向控制 电机右
#define motor_en1 PORTB |= 0x10
#define motor_en2 PORTB |= 0x20
#define motor_uen1 PORTB &=~ 0x10
#define motor_uen2 PORTB &=~ 0x20
//左电机向前 速度
extern void motor_left_forward(uint8 speed);
//左电机向后 速度
extern void motor_left_backward(uint8 speed);
//左电机滑行
extern void motor_left_stop(void);
//左电机刹车急停
extern void motor_left_quick_stop(void);
//左电机速度设定 速度
extern void motor_left_speed_set(uint8 speed);
//右电机向前 速度
extern void motor_right_forward(uint8 speed);
//右电机向后 速度
extern void motor_right_backward(uint8 speed);
//右电机滑行
extern void motor_right_stop(void);
//右电机刹车急停
extern void motor_right_quick_stop(void);
//右电机速度设定 速度
extern void motor_right_speed_set(uint8 speed);
//测试小车状态
extern void flag_test(void);
//直行
extern void straight(void);
//左转
extern void turn_left(void);
//右转
extern void turn_right(void);
//直回
extern void straight_back(void);
//停止
extern void stop(void);
//左微调
extern void mic_turn_left(void);
//右微调
extern void mic_turn_right(void);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -