Skip to content

bhagman/MillisTimer

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code
This branch is 8 commits ahead of WiringProject:master.

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
August 12, 2013 14:35
August 12, 2013 14:35
August 12, 2013 14:35

MillisTimer

Description

An Arduino/Wiring library for working with millis().

Documentation

This library provides an easy way to have recurring actions based on the millis() timer.

Example

#include "MillisTimer.h"

// Create a timer that fires every 1000 milliseconds.
MillisTimer timer1 = MillisTimer(1000);

// This is the function that is called when the timer expires.
void myTimerFunction(MillisTimer &mt)
{
  Serial.print("Repeat: ");
  Serial.println(mt.getRemainingRepeats());
}


void setup()
{
  Serial.begin(9600);

  timer1.setInterval(1000);
  timer1.expiredHandler(myTimerFunction);
  timer1.setRepeats(5);
  timer1.start();
}


void loop()
{
  timer1.run();

  if (!timer1.isRunning())
  {
    Serial.println("Timer finished!");
    for (;;);
  }
  
  delay(10);
}

About

A Wiring and Arduino library for working with millis().

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 100.0%