Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
main.cpp
- Committer:
- Wael_H
- Date:
- 2019-06-05
- Revision:
- 19:dad67302af25
- Parent:
- 17:aae5361ddddf
- Child:
- 20:a1b5d032b422
File content as of revision 19:dad67302af25:
#include "mbed.h"
#include "CAN_asser.h"
#include "Robot.h"
void automate_testDeplacement(Robot&);
int main(void)
{
Robot robot;
robot.setSpeed(40,400);
Timer timer_dbug;
timer_dbug.start();
while(1)
{
automate_testDeplacement(robot);
if(timer_dbug.read() > 0.5f)
{
dbug.printf("PosX : %d --- PosY : %d\n\r", robot.pos(Robot::X), robot.pos(Robot::Y));
dbug.printf("Angle : %d degres\n\r", robot.pos(Robot::THETA) / 10 );
sauter_lignes(25);
timer_dbug.stop();
timer_dbug.reset();
timer_dbug.start();
}
}
}
void automate_testDeplacement(Robot& robot)
{
typedef enum{AVANCE,TOURNE} type_etat;
static type_etat etat = AVANCE;
switch(etat)
{
case AVANCE:
if(robot.avance(500))
etat = TOURNE;
break;
case TOURNE:
if(robot.tourne(900))
etat = AVANCE;
break;
}
}