loading

//Code for Arduino

//Copy for Arduino 1.5.6

#include "U8glib.h"
#include
#include
#include // a basic DS1307 library that returns time as a time_t

U8GLIB_ST7920_128X64_1X u8g(6, 7, 8); //Konektor SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10
char *dayOfWeek[] = {"", "Nedela", "Pndelok", "Utorok", "Streda", "Stvrtok", "Piatok", "Sobota"};
char *monthWeek[] = {"", "Januar", "Februar", "Marec", "April", "Maj", "Jun", "Jul", "August", "September", "Oktober", "November", "December"};

//int potPin = 3; // change potPin value to 0, 1, 2 for A0, A1, A2 respectly
//float temperature = 0;
//int displayAtSecond;



void draw(void)
{

u8g.setFont(u8g_font_unifont);
u8g.setPrintPos(0, 10);




if (hour() < 10) {
u8g.print("0");
}
u8g.print(hour());
u8g.print(":");
if (minute() < 10) {
u8g.print("0");
}
u8g.print(minute());
u8g.print(":");
if (second() < 10) {
u8g.print("0");
}
u8g.print(second());
u8g.print(" ");
u8g.print(dayOfWeek[weekday()]);
u8g.setFont(u8g_font_unifont);
u8g.setPrintPos(0, 30);

if (day() < 10) {
u8g.print("0");
}
u8g.print(day());
u8g.print("");
u8g.print("*");
if (month() < 10) {
u8g.print(monthWeek[month()]);
}

u8g.print("*");
u8g.print(year());


}


void setup() {
//u8g.begin(9600);

u8g.print("*cheaphousetek*");
setSyncProvider(RTC.get); // the function to get the time from the RTC
if(timeStatus()!= timeSet)
u8g.print("Unable to sync");
else
u8g.print("Sync system time ");
// displayAtSecond = second();
delay(200);
Wire.begin();
}

void loop () {
u8g.firstPage();
do {
draw();
} while( u8g.nextPage() );
// rebuild the picture after some delay
delay(1000);

}

Step 1:

Edit for Arduino

<p>Hmm definitely looks interesting, I'd love some more detail on your build!</p>

About This Instructable

1,255views

8favorites

License:

More by mato01:CNC Aluminum Casting LED DS1302ButtonSET DS1307 lcd128x64 
Add instructable to: