going straight...slowly
parent
c346312bc9
commit
e1b50fcf03
14
src/game.cpp
14
src/game.cpp
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
Loading…
Reference in New Issue