its a library for testing the car

Dependencies:   FRDM-TFC

testing.cpp

Committer:
lh14g13
Date:
2016-12-04
Revision:
1:3396030f7c8a
Parent:
0:b9d22501052e

File content as of revision 1:3396030f7c8a:

#include "mbed.h"
#include "TFC.h"
#include "XBEE.h"
#include "testing.h"




float testSpeed(float speed)
{
    // every time the car sees the stop start the speed of the car will increase
    // this can occur on stop start trigger.
    // may need to send the speed back to the telemetry.
    if (speed>0.4)
    {
        speed+=0.05;
     }
     
     else
     {
       speed+=0.1;   
         
     }   
     
     
     sendString("s = %f", speed);
     return speed;
        
}



float lapTime(float newTime, float oldTime, int lapNo)
{
    // function which sends the lap time back to the telemetry.
    
    float laptime= newTime-oldTime;
    float avgTime= newTime/lapNo;
    
    sendString("For lap number: %d  Lap Time: %f  Avergae time: %f ", lapNo,lapTime,avgTime);
    
    
    return newTime;
}