Arduino Project Hub
Project showcase

Lapsed Time Timer © GPL3+

This is used as a clock accuracy check by triggering the minute or hour hands.

  • 222 views
  • 1 comment
  • 1 respect

Components and supplies

Linksprite 16x2 LCD Shield
×1
A000066 iso both
Arduino UNO & Genuino UNO
×1
OPB625 Slotted Optical Switch
DataSheet http://www.farnell.com/datasheets/685806.pdf?_ga=1.152005177.1802555626.1485114307
×1

Necessary tools and machines

09507 01
Soldering iron (generic)

About this project

Schematics

OPB625 Slotted Optical Switch wiring.
Connections and wiring for the optical sensor
Triggersensor 6ofrdiquw6

Code

Lapsed Time Timer Arduino
Reads an input on Trigger Pin. This starts the lapsed
// time timer. On the going low of Trigger Pin the lapsed
// time is logged. The minimum time that can be measured
// is 1 minute as the trigger is inhibited for this time.
//************************************************************
//                     Lapsed Time Timer                    //
//                By Robert Leney  January 2017             //
//************************************************************
//
//    Reads an input on Trigger Pin. This starts the lapsed
//    time timer. On the going low of Trigger Pin the lapsed
//    time is logged. The minimum time that can be measured 
//    is 1 minute as the trigger is inhibited for this time.
//
//***********************************************************
//   
//    Uses 16x2 LCD display. LCD pins need changing to suit
//    your setup.
//
//***********************************************************
#include <stdio.h>
#include <LiquidCrystal.h>

// LCD Initalisation ...............................
LiquidCrystal lcd(8, 13, 9, 4, 5, 6, 7);
//..................................................

//Array Constants
enum Mode { Days, Hrs, Mins, Secs};


// Time constant
const int second = 1000;
 
// Assign Trigger input pin
const int Trigger = 3;


void setup() {
// Setup LCD Display .........................

  lcd.begin(16, 2);
  lcd.clear();
  lcd.setCursor(0,0);
//...........................................

// Initalise input
pinMode( Trigger, INPUT);
}

void loop() {
// Timer ...............................................  
  bool Tripped = false; 
  
  // Initalised here to expand scope
       int secs  = 0;
       int mins  = 0;
       int hours = 0;
       int days  = 0;
  //...............................
   
  Serial.println("STARTED ");
  lcd.print("STARTED ");  
    for (days=0; days < 7; ++days){    
       for (hours=0; hours < 23; ++hours){
          for (mins=0; mins <59; ++mins){
            for (secs=0; secs < 59; ++secs){
                  // Counting Output
                  lcd.setCursor(0,1);
                  lcd.print("H ");  
                  lcd.print(hours);           
                  lcd.print(":M ");        
                  lcd.print(mins);  
                  lcd.print(":S "); 
                  lcd.print(secs);
                  lcd.print(" "); 
                  
              
                  if(digitalRead(Trigger) == LOW && Tripped == false){ 
                    Tripped = true;   // Inhibit Log for 1 minute
                      //Logged Output
                      lcd.clear();
                      lcd.setCursor(0,0);
                      lcd.print("H ");  
                      lcd.print(hours);           
                      lcd.print(":M ");        
                      
                      lcd.print(mins);  
                      lcd.print(":S "); 
                      lcd.print(secs); 
                      days=0;     
                      hours=0;
                      mins=0;
                      secs=0;
                  }
                 delay(second);                    //delay 1 second
           }
           Tripped = false;
        }
        
    }
  }
  //End Timer ..............................................................
}

Comments

Similar projects you might like

The Magic Display With Arduino - The Mind Reader

Project tutorial by LAGSILVA

  • 1,066 views
  • 2 comments
  • 4 respects

Very First Hands On Arduino - Voice Activated LED

Project tutorial by Liren Yeo

  • 401 views
  • 0 comments
  • 5 respects

Get Connected! WiFi Registration Using AP Mode!

Project tutorial by Brian Carbonette

  • 1,028 views
  • 0 comments
  • 15 respects

The Soldering Iron Controller for Hakko T12 Tips

Project tutorial by Alexander

  • 8,123 views
  • 4 comments
  • 26 respects

Voltmeter Using Arduino

by Team Next Tech Lab

  • 2,838 views
  • 8 comments
  • 44 respects

Prank Your Friends with Talking Darth Vader

Project tutorial by Chathuranga Liyanage

  • 163 views
  • 0 comments
  • 1 respect
Add projectSign up / Login