Dependencies: mbed
Diff: main.cpp
- Revision:
- 11:8d71a1e1e947
- Parent:
- 10:e412756d0f66
--- a/main.cpp Tue Jun 04 20:19:19 2019 +0000 +++ b/main.cpp Fri Aug 09 17:11:40 2019 +0000 @@ -10,6 +10,8 @@ #include "Motor.h" #include "Sensor.h" +Serial bt(p28, p27); + //Definição das variaveis para as velocidades dos motores float LMotor = 0; float RMotor = 0; @@ -31,6 +33,10 @@ //################################################################################ //################################################################################ //******************************* FUNCOES - INICIO ****************************** +void bluetooth (float left, float right) { + bt.printf("%d, %.2f, %.2f, %d, %d\n\r", Get_Position(), left, right,Get_Left(),Get_Right()); + +} //Funcao que inicializa a interrupcao do sensor lateral direito @@ -47,7 +53,7 @@ led4 = 0; #endif - END.attach(&Stop, 20.0); //Inicia END para executar a função Stop depois de 20s + //END.attach(&Stop, 20.0); //Inicia END para executar a função Stop depois de 20s //Loop infinito while (1) { // Valor correto: 17/18 @@ -64,8 +70,9 @@ }*/ Read_Sensors(); //Lê os sensores PID_Control(Get_Position(), &LMotor, &RMotor); //Calcula o controle - Drive(LMotor, RMotor); //Passa os valores pro motor - wait(0.0035); //Se não tiver delay motor fica sem controle + Drive(LMotor, RMotor); + bluetooth(LMotor,RMotor); //Passa os valores pro motor + //wait(0.0035); //Se não tiver delay motor fica sem controle } /*for (i=0; i < 4200; i++) { @@ -75,7 +82,7 @@ } Stop();*/ - return 1; + return 0; } //******************************** FUNCOES - FINAL ****************************** \ No newline at end of file