going straight...slowly

code_midgen
u-siri-ous 2019-12-02 16:59:20 +01:00
parent c346312bc9
commit e1b50fcf03
2 changed files with 13 additions and 9 deletions

View File

@ -5,16 +5,18 @@ Game::Game(){
}
void Game::goalie(){
compass->readSensor();
digitalWrite(LED_G, HIGH);
//if(ball->ballSeen){
//if(ball->angle >= 0) {
drive->prepareDrive(0, 150, 0);
drive->drive(0, 150, 0);
//}
//} else drive->prepareDrive(0, 0, 0);
if(ball->ballSeen){
if(ball->angle >= 0) {
drive->prepareDrive(0, 50, 0);
drive->drive(0, 50, 0);
}
} else drive->prepareDrive(0, 0, 0);
}
void Game::keeper(){
compass->readSensor();
digitalWrite(LED_Y, HIGH);
}

View File

@ -12,13 +12,15 @@ void setup() {
}
void loop() {
updateSensors();
//updateSensors();
/*if(millis() % 100 == 0)
DEBUG_PRINT.println(us->getValue());*/
if(game->role) game->goalie();
else game->keeper();
/* if(game->role) game->goalie();
else game->keeper(); */
game->goalie();
game->role = digitalRead(SWITCH_DX);
game->attackGoal = digitalRead(SWITCH_SX);
//compass->test();
//usCtrl->test();
delay(200);
}