Project showcase

Lapsed Time Timer © GPL3+

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

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

Online Attendance System (Without Ethernet)

Project tutorial by gadgetprogrammer

  • 333 views
  • 5 comments
  • 8 respects

Windows PC Lock/Unlock Using RFID

Project tutorial by Prasanth K S

  • 6,961 views
  • 6 comments
  • 30 respects

Makers (Cubecon) #1 Infrared Transmit & Infrared Receive

Project in progress by Alpha

  • 178 views
  • 0 comments
  • 4 respects

Arduino Keyboard

Project in progress by Gabriele Scordamaglia

  • 519 views
  • 4 comments
  • 5 respects
Add projectSign up / Login