The Alpha Geek – Geeking Out

Project #7: RGB LCD Shield – Mk01

RGB LCD Shield
Project #7 – Mk01

ChronoDot

1 x RGB LCD Shield 16×2 Character Display
1 x Arduino Uno – R3
1 x ProtoScrewShield
1 x ChronoDot
4 x Jumper Wires 3″ M/M
1 x Half-Size Breadboard

A5
A4
GND
3.3V

DonLuc1804Mk07a.ino

// ***** Don Luc *****
// Software Version Information
// 1.03
// DonLuc1804Mk07 1.03
// RGB LCD Shield
// ChronoDot

// include the library code:
#include <Wire.h>
#include <Adafruit_MCP23017.h>
#include <Adafruit_RGBLCDShield.h>
#include <RTClib.h>
#include <RTC_DS3231.h>

RTC_DS3231 RTC;

#define SQW_FREQ DS3231_SQW_FREQ_1024     //0b00001000   1024Hz

Adafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield();

#define GREEN 0x2

// ChronoDot
char datastr[100];

void loop() {

  RGBLCDShield.clear();

  timeChrono();
   
  delay(2000);  

}

ChronoDot.ino

void setupChrono() {

  RTC.begin();
  
  DateTime now = RTC.now();
  DateTime compiled = DateTime(__DATE__, __TIME__);
  RTC.getControlRegisterData( datastr[0] );  
  
}

void timeChrono() {
 
    DateTime now = RTC.now();
    DateTime isNow (now.unixtime() + 6677 * 86400L + 42500);

    // set the cursor to column 0, line 0
    RGBLCDShield.setCursor(0,0);
    RGBLCDShield.print(isNow.year(), DEC);
    RGBLCDShield.print('/');
    RGBLCDShield.print(isNow.month(), DEC);
    RGBLCDShield.print('/');
    RGBLCDShield.print(isNow.day(), DEC);
    RGBLCDShield.print(' ');
    RGBLCDShield.print(' ');

    // set the cursor to column 0, line 1
    RGBLCDShield.setCursor(0, 1);
    RGBLCDShield.print(isNow.hour(), DEC);
    RGBLCDShield.print(':');
    RGBLCDShield.print(isNow.minute(), DEC);
    RGBLCDShield.print(':');
    RGBLCDShield.print(isNow.second(), DEC);
    RGBLCDShield.print(' ');
    RGBLCDShield.print(' ');
    
}

setup.ino

void setup() {

  // set up the LCD's number of columns and rows: 
  RGBLCDShield.begin(16, 2);

  RGBLCDShield.print("Don Luc");
  RGBLCDShield.setBacklight(GREEN);
   // set the cursor to column 0, line 1
  RGBLCDShield.setCursor(0, 1);
  // print the number of seconds since reset:
  RGBLCDShield.print("ChronoDot"); 

  delay(5000);

  // ChronoDot
  setupChrono();
  
  delay(1500); //wait for the sensor to be ready 
  
}

Don Luc

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories
Archives