Panel Cookies
Arduino watch PCB - RTC example CODE
Help me by sharing this post



This is the code used with my Arduino watch development board fot the real time clock example. You will also need the OLED screen libraries and the DS3231 libraries so download those from below and install them before compiling the code. Download the code or copy it from below and uplaod it to the PCB.


RTC example code: (last update 20/01/2019)

Download Adafruit_GFX library:
Download Adafruit_SSD1306 library:
Download DS3231 library:
Download DS3231RTC library:



Arduino smartwatch PCB code





#include <DS3231.h>
#include <DS3232RTC.h> 
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

DS3231  rtc(SDA, SCL);
#define OLED_RESET 9
Adafruit_SSD1306 display(OLED_RESET);



void setup() {
  rtc.begin();
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3C (for the 128x32)
  delay(100);
  
  display.clearDisplay();
  display.display();

}

void loop() {
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(WHITE);  
  display.setCursor(0,0);
  display.print(rtc.getDOWStr()); 

  display.setCursor(0,17);
  display.print(rtc.getTimeStr());

  display.setCursor(0,34);
  display.print(rtc.getDateStr());

  display.setCursor(0,52);
  display.print("Temp: ");
  display.print(rtc.getTemp());
  display.print(" deg");

  
  display.display();
  


  
  delay(500);
}








yt_link
insta_link
fb_link
twitter_link

Arduino watch PCB



Affiliate Disclosure

ADVERTISERS



PCBWAY PCB service





Curso Arduino Online nivel bajo