初级会员

- 积分
- 178
- 金钱
- 178
- 注册时间
- 2015-8-29
- 在线时间
- 17 小时
|
1金钱
用MINI32,用一个L298N控制两个电机,本来程序写的是使电机停止转动,可是有一边的两个电机一下子转,一下子停止,不知道怎么回事。
void DC_motor_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_5;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_SetBits(GPIOA,GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_5);
}
|
|