Understanding state machine example

It would be better to change them to be:

const int StartTime = 500;
const int ScanTime = 1500;
const int RESULTSTime = 1500;
const int ResetTime = 2000;

Since they won't ever change (hence the 'const' keyword) and they are much smaller than a long you can save some memory by keeping them ints.

FWIW,

Brad
KF7FER