Bonjour,
étant en train de programmer un robot "maïs" , qui est censé suivre les rang d'un champ de maïs , je me sert du mowayduino comme maquette.
jusqu'ici tout allait bien jusqu'au demi-tour où je tombe sur un os car il doit faire un demi tour a gauche et un demi tour a droite j'ai tout le programme de suivi de rang avec un demi tour mais pour alterner un a gauche et un a droite je ne trouve malheureusement aucune solution, j'ai cherché pendant plusieurs jours sans trouver de réponses
si quelqu'un pouvais me venir en aide merci
voilà mon programme
mowayduinorobot robot;
void RfDataReady();
void RfDataReady()
{}
void setup()
{
robot.beginMowayduino();
Serial.begin(57600);
delay(2000);
}
void loop()
{
robot.Straight(100);
robot.readObstacle();
if(robot.Obstacle[IR_LR] > 900)
{ turnleft(); }
if(robot.Obstacle[IR_LL] > 900)
{turnright(); }
if (robot.Obstacle[IR_LR] <= 100)
{ReturnLeft();}
}
void ReturnRight()
{ robot.Straight(200, 40);
robot.TurnRight(200, 55);
robot.Straight(100, 30);
robot.TurnRight(200, 80);
robot.Straight(100, 20);
robot.TurnRight(100, 40);}
void ReturnLeft()
{ robot.Straight(200, 40);
robot.TurnLeft(200, 55);
robot.Straight(100, 30);
robot.TurnLeft(200, 80);
robot.Straight(100, 20);
robot.TurnLeft(100, 40);}
void turnleft()
{robot.TurnLeft(200, 15);}
void turnright()
{robot.TurnRight(200, 15);}