IN2(High);
}
void Motor_1_PRun(void)
{
IN1(Low);
IN2(High);
}
void Motor_1_NRun(void)
{
IN1(High);
IN2(Low);
}
void Motor_2_STOP(void)
{
IN3(High);
IN4(High);
}
void Motor_2_PRun(void)
{
IN3(Low);
IN4(High);
}
void Motor_2_NRun(void)
{
IN3(High);
IN4(Low);
}
motor.h
#ifndef __MOTOR1_H
#define __MOTOR1_H
#include “stm32f10x.h”
#include “stm32f10x_gpio.h”
#define High 1
#define Low 0
#define IN1(a) if (a) \
GPIO_SetBits(GPIOF,GPIO_Pin_0);\
else \
GPIO_ResetBits(GPIOF,GPIO_Pin_0)
#define IN2(a) if (a) \
GPIO_SetBits(GPIOF,GPIO_Pin_1);\
else \
GPIO_ResetBits(GPIOF,GPIO_Pin_1)<

文章介绍了如何在STM32平台上使用GPIO、TIM3进行PWM控制舵机,以及通过USART1与HC-06蓝牙模块通信,详细展示了电机配置和主程序的代码示例。
最低0.47元/天 解锁文章
994

被折叠的 条评论
为什么被折叠?



