Endelig kildekode med rettelser.

Dependencies:   PID mbed

Fork of EndeligKildekode by E2016-S1-Team5

robot.cpp

Committer:
kimnielsen
Date:
2016-12-15
Revision:
9:f14532fd7a02
Parent:
8:5ca76759a67e

File content as of revision 9:f14532fd7a02:

/*
 ============================================================================
 Name        : robot.cpp
 Author      : Team 5
 Version     : 0.1
 Date        : 13-10-2016
 Copyright   : Open for all
 Description : Program to serve the platform for Pro1 2016
 ============================================================================
 */ 
#include "odometry.h" 
#include "mbed.h"
#include "hack_motor.h"
#include <math.h> 

void startfunction( );
Ticker T1; // create an object T1 of Ticker 

int main()
{ 
  startfunction();
  distance = 2000;
  get_to_goal();;
  robot.stop();
  distance = 4500;
  wait_ms(1000);
  
   init();
   while(tickR <= 16)
   {
    robot.FW(0.5, 0);
    wait_ms(10);
    }
    robot.stop();
  
  while(1)   
  {
   init();
   startfunction();
   get_to_goal();
   robot.stop(); 
   wait_ms(1000);
   
   init();
   while(tickR <= 16)
   {
    robot.FW(0.5, 0);
    wait_ms(10);
    }
    robot.stop();
} 
}     
void startfunction()
{
    tacho_left.rise(&tickLeft);  // attach the address of the count function
    //to the falling edge
    tacho_right.rise(&tickRight);  // attach the address of the count function
    //to the falling edge
    init(); // initialise parameters (just for you to remember if you need to)
    wait_ms(2000); //wait 1 secs here before you go
    t.start();      // start timer (just demo of how you can use a timer)
}