Author Topic: Mission 8 - Real Time Clock  (Read 753 times)

dalich

  • Administrator
  • Jr. Member
  • *****
  • Posts: 77
Mission 8 - Real Time Clock
« on: June 28, 2016, 08:19:15 AM »
Mission 8-1.bmp

Mission 8-2.bmp

Wiring Guide

NANO D2 -> LCD D7
NANO D3 -> LCD D6
NANO D4 -> LCD D5
NANO D5 -> LCD D4
NANO D11 -> LCD E
NANO D12 -> LCD RS
NANO GND -> LCD Led (-) -> LCD RW -> LCD GND
NANO 5V -> LCD (+) -> LCD Led (+)
NANO 5V -> RTC VCC
NANO GND -> RTC GND
NANO A4 -> RTC SDA
NANO A5 -> RTC SCL


isaac.a has granted permission for this cod.

*The initial upload of this code will set the time and date as send from your computer.  After the first uploading of the code, place the line below "commented" (//) and this will not set the time each time it is uploaded.

 "//RTC.adjust(DateTime(__DATE__, __TIME__));"

You may need to install the library file for the DS1307 clock module.

Here is a link to a great RTC tutorial with more details and explanations if desired.

http://www.manelsoft.com/projects/arduino_ds1307_clock.aspx

*RTClib.zip

Code: [Select]
/*
Mission 8 - Real Time Clock

This mission (project) was written specifically for DuinoKit.
Feel free to use, modify and also share what you have
learned and invented through this process on the
Show and Tell forum on www.DuinoKit.com

Wiring Guide
NANO D2 -> LCD D7
NANO D3 -> LCD D6
NANO D4 -> LCD D5
NANO D5 -> LCD D4
NANO D11 -> LCD E
NANO D12 -> LCD RS
NANO GND -> LCD Led (-) -> LCD RW -> LCD GND
NANO 5V -> LCD (+) -> LCD Led (+)
NANO 5V -> RTC VCC
NANO GND -> RTC GND
NANO A4 -> RTC SDA
NANO A5 -> RTC SCL

*/
#include <Wire.h>
#include "RTClib.h"
#include <LiquidCrystal.h>

RTC_DS1307 RTC;

LiquidCrystal lcd(12, 11, 5, 4, 3 ,2);   //  Arduino Pins
                    //(RS,E,D4,D5,D6,D7);  LCD Pins
void setup () {
  Serial.begin(9600);
  lcd.begin(16, 2);
  Wire.begin();
  RTC.begin();

  if (! RTC.isrunning()) {
    Serial.println("RTC is NOT running!");
    RTC.adjust(DateTime(F(__DATE__), F(__TIME__)));
  }
}

void loop () {
  DateTime now = RTC.now();

  Serial.print(now.year(), DEC);
  Serial.print('/');
  Serial.print(now.month(), DEC);
  Serial.print('/');
  Serial.print(now.day(), DEC);
  Serial.print(' ');
  Serial.print(now.hour(), DEC);
  Serial.print(':');
  Serial.print(now.minute(), DEC);
  Serial.print(':');
  Serial.print(now.second(), DEC);
  Serial.println();


  lcd.setCursor(0, 0);
  lcd.print("TIME: ");
  lcd.print(now.hour(), DEC);
  lcd.print(":");
  lcd.print(now.minute(), DEC);
  lcd.print(":");
  lcd.print(now.second(), DEC);

  lcd.setCursor(0, 1);
  lcd.print("DATE: ");
  lcd.print(now.year(), DEC);
  lcd.print("/");
  lcd.print(now.month(), DEC);
  lcd.print("/");
  lcd.print(now.day(), DEC);

  delay(1000);
}
« Last Edit: February 12, 2017, 07:16:13 PM by dalich »

AlexmenEl

  • Newbie
  • *
  • Posts: 1
    • Hi
Mission 8 Real Time Clock
« Reply #1 on: October 03, 2016, 05:50:19 AM »
The play clock is started anytime the ball is marked ready for play. This includes kickoffs.
Antibiotics for bronchitis http://helpyouantibiotic.top

rentdressni

  • Newbie
  • *
  • Posts: 5
    • купить коленчатый вал
Mission 8 Real Time Clock
« Reply #2 on: November 28, 2016, 10:48:09 AM »
Thanks. Might have found those if I had searched for RTC intead of Real Time Clock