Project showcase

Lapsed Time Timer © GPL3+

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

  • 309 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

Water Softener

Project tutorial by moty

  • 265 views
  • 0 comments
  • 5 respects

Know the Temp of Your Home From Anywhere with Arduino Cloud!

Project tutorial by Isaac100

  • 1,312 views
  • 0 comments
  • 9 respects

Simple Obstacle Senor With Arduino

Project tutorial by muhammed shameel k.v

  • 88 views
  • 0 comments
  • 2 respects

Safe City: A Device to Keep You Safe

Project tutorial by Patel Darshil

  • 630 views
  • 0 comments
  • 6 respects

Scavenger Hunt Clues w/ Telephone Keypad

Project tutorial by Sam Horne

  • 959 views
  • 0 comments
  • 3 respects
Add projectSign up / Login