Arduino Project Hub
Project showcase

Lapsed Time Timer © GPL3+

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

  • 16 views
  • 0 comments
  • 0 respects

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

Arduino 101 - Intel Curie Pattern Matching Dress

Project tutorial by Kitty Yeung

  • 304 views
  • 2 comments
  • 7 respects

Fun Cases for Electronic Components

Project in progress by circuito.io team

  • 1,661 views
  • 4 comments
  • 22 respects

Magnetic Stirrer

Project showcase by jdale18

  • 375 views
  • 7 comments
  • 3 respects

Simple Ultrasonic distance measurer with LCD display

Project tutorial by onatto22

  • 427 views
  • 0 comments
  • 7 respects

Useless box

Project showcase by brzi and Igor Putnik

  • 1,024 views
  • 0 comments
  • 9 respects
Add projectSign up / Login