DovesLapTimer 4.0.0
GPS-based lap timing Arduino library — go-karts to race cars
Loading...
Searching...
No Matches
sector_timing_example.ino File Reference
#include <DovesLapTimer.h>

Functions

void displaySectorInfo ()
 
void generateSyntheticFix (unsigned long step, double &lat, double &lng)
 
DovesLapTimer lapTimer (crossingThresholdMeters, &Serial)
 
void loop ()
 
void setup ()
 

Variables

const double crossingThresholdMeters = 7.0
 
const unsigned int LAPS_TO_RUN = 3
 
const double sector2PointALat = 28.41310
 
const double sector2PointALng = -81.37860
 
const double sector2PointBLat = 28.41310
 
const double sector2PointBLng = -81.37880
 
const double sector3PointALat = 28.41345
 
const double sector3PointALng = -81.37925
 
const double sector3PointBLat = 28.41365
 
const double sector3PointBLng = -81.37925
 
const float SIM_ALT_METERS = 50.0f
 
const unsigned long SIM_MS_PER_STEP = 200
 
const float SIM_SPEED_KNOTS = 48.0f
 
unsigned long simTimeMs = 3600000UL
 
const double startFinishPointALat = 28.41255
 
const double startFinishPointALng = -81.37920
 
const double startFinishPointBLat = 28.41275
 
const double startFinishPointBLng = -81.37920
 
unsigned long stepCount = 0
 
const unsigned int STEPS_PER_LAP = 80
 
const double TRACK_EAST_LNG = -81.37870
 
const double TRACK_NORTH_LAT = 28.41355
 
const double TRACK_SOUTH_LAT = 28.41265
 
const double TRACK_WEST_LNG = -81.37970
 

Function Documentation

◆ displaySectorInfo()

void displaySectorInfo ( )

◆ generateSyntheticFix()

void generateSyntheticFix ( unsigned long  step,
double &  lat,
double &  lng 
)

◆ lapTimer()

DovesLapTimer lapTimer ( crossingThresholdMeters  ,
Serial 
)

◆ loop()

void loop ( )

◆ setup()

void setup ( )

Variable Documentation

◆ crossingThresholdMeters

const double crossingThresholdMeters = 7.0

◆ LAPS_TO_RUN

const unsigned int LAPS_TO_RUN = 3

◆ sector2PointALat

const double sector2PointALat = 28.41310

◆ sector2PointALng

const double sector2PointALng = -81.37860

◆ sector2PointBLat

const double sector2PointBLat = 28.41310

◆ sector2PointBLng

const double sector2PointBLng = -81.37880

◆ sector3PointALat

const double sector3PointALat = 28.41345

◆ sector3PointALng

const double sector3PointALng = -81.37925

◆ sector3PointBLat

const double sector3PointBLat = 28.41365

◆ sector3PointBLng

const double sector3PointBLng = -81.37925

◆ SIM_ALT_METERS

const float SIM_ALT_METERS = 50.0f

◆ SIM_MS_PER_STEP

const unsigned long SIM_MS_PER_STEP = 200

◆ SIM_SPEED_KNOTS

const float SIM_SPEED_KNOTS = 48.0f

◆ simTimeMs

unsigned long simTimeMs = 3600000UL

◆ startFinishPointALat

const double startFinishPointALat = 28.41255

◆ startFinishPointALng

const double startFinishPointALng = -81.37920

◆ startFinishPointBLat

const double startFinishPointBLat = 28.41275

◆ startFinishPointBLng

const double startFinishPointBLng = -81.37920

◆ stepCount

unsigned long stepCount = 0

◆ STEPS_PER_LAP

const unsigned int STEPS_PER_LAP = 80

◆ TRACK_EAST_LNG

const double TRACK_EAST_LNG = -81.37870

◆ TRACK_NORTH_LAT

const double TRACK_NORTH_LAT = 28.41355

◆ TRACK_SOUTH_LAT

const double TRACK_SOUTH_LAT = 28.41265

Sector Timing Example for DovesLapTimer

This example demonstrates 3-sector split timing using a SYNTHETIC GPS track — no GPS hardware required. The library is driven through three simulated laps around a 100m × 100m square loop so you can see sector times, best times, and optimal-lap calculation light up on Serial.

Sector layout:

  • Sector 1: Start/Finish -> Sector 2 line
  • Sector 2: Sector 2 line -> Sector 3 line
  • Sector 3: Sector 3 line -> Start/Finish

To adapt for a real track:

  1. Replace the four pairs of crossing-line coordinates below with your own (Google Maps right-click -> copy lat,lng).
  2. Delete generateSyntheticFix() and the LAPS_TO_RUN stop condition.
  3. In loop(), replace the synthetic GPS block with reads from your GPS module: feed lat, lng, altitude (m), and speed (knots) into lapTimer.loop(), and ms-since-midnight into lapTimer.updateCurrentTime().

◆ TRACK_WEST_LNG

const double TRACK_WEST_LNG = -81.37970