Page 157 - 최강 아두이노 스마트 자동차 로봇 키트
P. 157
Serial.print(" ");
if (retDir == DIR_DISC_CENTER)
Serial.println("DIR CENTER");
if (retDir == DIR_DISC_LEFT)
Serial.println("DIR LEFT");
if (retDir == DIR_DISC_RIGHT)
Serial.println("DIR RIGHT");
return retDir;
}
// initialize system.
void initSystem()
{
myservo.attach(SERVO_PIN); // attaches the servo on pin
13 to the servo object
//
delay(100);
setRotateServo(SERVO_DIR_CENTER);
delay(1000); //
init_car_controller_board();
car_update();
//
print_car_info();
init_ultrasonic_sensor();
}
/**/
void controllerCommand(String& szIRCmd)
{
if (szIRCmd == "+") // speed up
{
g_carSpeed += 20;
g_carSpeed = min(g_carSpeed, 255);
Serial.print("Speed Up ");
Serial.println(g_carSpeed);
car_update();
return;
}
else
if (szIRCmd == "-") // speed down
156