pepe

Dependencies:   mbed Matrix

main.cpp

Committer:
PedroMartins96
Date:
2019-05-22
Revision:
1:2716ea33958b
Parent:
0:a7324f51348d
Child:
2:06b7789c7da0

File content as of revision 1:2716ea33958b:

#include "mbed.h"
#include "Robot.h"
#include "Communication.h"

//Serial pc(SERIAL_TX, SERIAL_RX);
InterruptIn button(USER_BUTTON);

volatile bool mode=true;
float x1=20,y1=20;          // Posição inicial do robo
float a1=0,b1=-1,c1=65;       // Reta ax + by + c = 0
float x2=65,y2=60,phi2=-pi/2; // Pose arbitrária
int p[2] = {100,100};
int p1[2] = {140, 80};
int p2[2] = {140, 35};
int p3[2] = {140, 130};

void pressed()
{
    mode = !mode;
}

int main()
{
    //pc.baud(9600);
    button.fall(&pressed);
    setSpeeds(0,0);
    //wait(0.2);
    mapa(80,80);
    cria_obj(60,40,p);
    //cria_obj(20,10,p1);
    //cria_obj(20,60,p2);
    //cria_obj(20,40,p3);

    //int_map(80, 80);
    while(1) {
        if (mode==true) {
            setSpeeds(0,0);

        } 
        else {
            setSpeeds(0,0); 
            
            motion();
            wait(1);
            
            VFF();
            //mode = true;
        }
    }
}