Help on Timer code


heixin: i'm tyring to reset timer and start timer


For calculating pulses.

So you're pulling out your hair trying to reset millis when all you have to do is...

unsigned long Start;
unsigned long Stop;
unsigned long Delta;

void setup( void )

void loop( void )
  // Put code here to wait for pulse start
  Start = millis();
  // Put code here to wait for pulse stop
  Stop = millis();

  Delta = Stop - Start;
  // Put code here to use Delta (pulse width in milliseconds)

You may get help resetting millis but it will not be from me. Especially given the fact that a simple solution is so readily available.

heixin: Thanks.!but i'm calculating in bits not millis.

I don't understand that. Bits is not a time interval, nor is millis(). millis() is a function.

What was wrong with Coding Badly's solution?

i'm finding a way to reset and start timer.

Look, if you want to cook a roast turkey for 2 hours, do you reset the clock on the wall back to midnight? Or do you make a note of the time you started cooking, and then notice when 2 hours have passed?