TP_presa

Dependencies:   SRF08 Servo mbed

main.cpp

Committer:
Remi95
Date:
2017-06-26
Revision:
6:d61052f4ab1e
Parent:
5:8c2101d3ecef
Child:
7:7d3c6326cbc3

File content as of revision 6:d61052f4ab1e:

#include "mbed.h"
#include "CAR.h"
#include "SRF08.h"

Serial bth(p13,p14);
SRF08 capteur_US(p28,p27,0x0E);
CAR robot(p9,p10);
//CAR robot;

void act(char action) {
            switch(action) {
                case 'a':
                    bth.printf("avancer\n\r");
                    robot.avancer(70);
                    break;
                case 's':
                    bth.printf("stop\n\r");
                    robot.arreter();
                    break;
                case 'u':
                    bth.printf("arret\n\r");
                    robot.arreter();
                    break;
                case 'r':
                    bth.printf("reculer\n\r");
                    robot.reculer(70);
                    break;
                case 'd':
                    bth.printf("droite\n\r");
                    robot.tourner_droite(70);
                    break;
                case 'g':
                    bth.printf("gauche\n\r");
                    robot.tourner_gauche(70);
                    break;
                case 'h':
                    bth.printf("demi tour horaire\n\r");
                    robot.demi_tour_droite(100);
                    break;
                case'l':
                    bth.printf("demi tour left\n\r");
                    robot.demi_tour_gauche(100);
                    break;
            }
            action='0';
        }
int main(void)
{
    //S2=0;
  //  CAR(p9,p10);
    
    while(1) {
      
    }
}