pepe

Dependencies:   mbed Matrix

main.cpp

Committer:
PedroMartins96
Date:
2019-03-13
Revision:
0:a7324f51348d
Child:
1:2716ea33958b

File content as of revision 0:a7324f51348d:

#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=40,y1=-40;          // Posição inicial do robo
float a1=1,b1=-2,c1=4;       // Reta ax + by + c = 0
float x2=50,y2=50,phi2=pi/2; // Pose arbitrária

void pressed()
{
    mode= !mode;
}

int main()
{
    pc.baud(9600);
    button.fall(&pressed);

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

        } else {
            setSpeeds(0,0); 
            
            motion();
            wait(1);
            
            //to_point(x1,y1);
            //to_line(a1,b1,c1);
            to_pos(x2,y2,phi2);
        }
    }
}