Programski kod sata/brojača. Izveden pomoću 4 tipkala i LCD zaslonom rezolucije 16x2 točaka.

Dependencies:   mbed Bljeskalica TextLCD

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.h Source File

main.h

00001 #include "mbed.h"
00002 #include "TextLCD.h"
00003 #include "Flasher.h"
00004 #include "tipkala.h"
00005 
00006 TextLCD LCD (p19, p20, p21, p22, p23, p24); //RS,E,D0,D1,D2,D3
00007 
00008 Flasher led(LED1);
00009 
00010 int MENU = 0; 
00011 
00012 void ZASLON();
00013 
00014 void vrijeme() {
00015     set_time(1577836800+offset); }
00016 
00017 void ZASLON() {
00018     time_t seconds = time(NULL);
00019         
00020         if (MENU==0) {
00021         LCD.cls(); 
00022         LCD.locate(2,0);
00023         char day[16];
00024 
00025         strftime(day, 16, "%d/%m/%y %a\n", localtime(&seconds));
00026         LCD.printf("%s", day);
00027         
00028         char time[16];
00029         strftime(time, 16, "%H:%M:%S\n", localtime(&seconds));
00030         LCD.locate(4,1);
00031         LCD.printf("%s", time);}
00032 }
00033