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

BluSpike - Community Driven BLE Sensor Network

Project tutorial by Moheeb Zara

  • 72 views
  • 0 comments
  • 2 respects

Arduino - Have Fun with Color Sensor

Project tutorial by khanhhs

  • 1,067 views
  • 0 comments
  • 15 respects

Using Python and Arduino MKR1000 for Secure IoT

Project tutorial by Luigi Francesco Cerfeda

  • 3,333 views
  • 1 comment
  • 15 respects

Arduino - Web-Based Thermometer

Project tutorial by khanhhs

  • 1,178 views
  • 0 comments
  • 15 respects

NeoPixel Thermometer!

Project tutorial by fmattiussi

  • 262 views
  • 1 comment
  • 4 respects

Play Music With Your Remote

Project tutorial by Simone Adobs

  • 901 views
  • 12 comments
  • 7 respects
Add projectSign up / Login