its a library for testing the car

Dependencies:   FRDM-TFC

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers testing.cpp Source File

testing.cpp

00001 #include "mbed.h"
00002 #include "TFC.h"
00003 #include "XBEE.h"
00004 #include "testing.h"
00005 
00006 
00007 
00008 
00009 float testSpeed(float speed)
00010 {
00011     // every time the car sees the stop start the speed of the car will increase
00012     // this can occur on stop start trigger.
00013     // may need to send the speed back to the telemetry.
00014     if (speed>0.4)
00015     {
00016         speed+=0.05;
00017      }
00018      
00019      else
00020      {
00021        speed+=0.1;   
00022          
00023      }   
00024      
00025      
00026      sendString("s = %f", speed);
00027      return speed;
00028         
00029 }
00030 
00031 
00032 
00033 float lapTime(float newTime, float oldTime, int lapNo)
00034 {
00035     // function which sends the lap time back to the telemetry.
00036     
00037     float laptime= newTime-oldTime;
00038     float avgTime= newTime/lapNo;
00039     
00040     sendString("For lap number: %d  Lap Time: %f  Avergae time: %f ", lapNo,lapTime,avgTime);
00041     
00042     
00043     return newTime;
00044 }
00045