Page 182 - 최강 아두이노 스마트 자동차 로봇 키트
P. 182
}
void car_forward()
{
digitalWrite(EN1, LOW);
digitalWrite(EN2, HIGH);
analogWrite(ENA, g_carSpeed);
digitalWrite(EN3, LOW);
digitalWrite(EN4, HIGH);
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()
{
181