Erik -
/
Mini_DK_clk
Simple clock program for LPC1768 Mini-DK
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "Mini_DK.h" 00002 #include "mbed.h" 00003 #include "RTC.h" 00004 00005 DigitalOut led(DK_LED1); 00006 00007 TouchScreenADS7843 TFT(TP_SDI ,TP_SDO ,TP_SCK ,TP_CS ,TP_IRQ ,LCD_SDI, LCD_SDO, LCD_SCK, LCD_CS, NC,"TFT"); 00008 00009 void displayFunction( void ) 00010 { 00011 led = !led; 00012 TFT.locate(20,50); 00013 time_t seconds = time(NULL); 00014 char buffer[32]; 00015 00016 strftime(buffer, 32, "%H:%M:%S", localtime(&seconds)); 00017 TFT.printf("%s", buffer); 00018 } 00019 00020 int main() 00021 { 00022 set_time(1256729737); // Set time to Wed, 28 Oct 2009 11:35:37 00023 TFT.TP_Init(); 00024 00025 TFT.background(Black); // set background to black 00026 TFT.foreground(White); // set chars to white 00027 00028 00029 00030 TFT.cls(); 00031 TFT.set_font((unsigned char*) Arial28x28); 00032 TFT.set_orientation(1); 00033 00034 00035 RTC::attach(&displayFunction, RTC::Second); 00036 00037 while(1) {} 00038 }
Generated on Tue Jul 12 2022 17:26:32 by 1.7.2