You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
540 B
29 lines
540 B
#ifndef _PWM_H |
|
#define _PWM_H |
|
|
|
|
|
#include <reg51.h> |
|
#include "IRIN.h" |
|
|
|
void delay(unsigned int k); |
|
void run(void); |
|
void backrun(void); |
|
void leftrun(void); |
|
void rightrun(void); |
|
void pwm_out_left_moto(void); |
|
void pwm_out_right_moto(void); |
|
|
|
|
|
//定义小车驱动模块输入IO口 |
|
sbit IN1=P1^0; |
|
sbit IN2=P1^1; |
|
sbit EN1=P3^4; |
|
sbit Right_moto_pwm=P3^4; //PWM信号端 |
|
|
|
|
|
#define Right_moto_go {IN1=1,IN2=0;} //右边电机向前走 |
|
#define Right_moto_back {IN1=0,IN2=1;} //右边电机向后走 |
|
#define Right_moto_Stop {EN1=0;} //右边电机停转 |
|
|
|
|
|
#endif |