Page 238 - 최강 아두이노 스마트 자동차 로봇 키트
P. 238
analogWrite(ENB, g_carSpeed);
}
void car_backward()
{
digitalWrite(EN1, HIGH);
digitalWrite(EN2, LOW);
analogWrite(ENA, g_carSpeed);
digitalWrite(EN3, HIGH);
digitalWrite(EN4, LOW);
analogWrite(ENB, g_carSpeed);
}
//
void car_left()
{
digitalWrite(EN1, HIGH);
digitalWrite(EN2, LOW);
analogWrite(ENA, g_carSpeed);
digitalWrite(EN3, LOW);
digitalWrite(EN4, HIGH);
analogWrite(ENB, g_carSpeed);
}
//
void car_right()
{
digitalWrite(EN1, LOW);
digitalWrite(EN2, HIGH);
analogWrite(ENA, g_carSpeed);
digitalWrite(EN3, HIGH);
digitalWrite(EN4, LOW);
analogWrite(ENB, g_carSpeed);
}
//
//
void car_stop()
{
analogWrite(ENA, 0);
237