Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:examples:display:lcd [2015/11/05 11:43] heikopikneren:examples:display:lcd [2020/07/20 09:00] (current) – external edit 127.0.0.1
Line 1: Line 1:
-~~PB~~+<pagebreak>
 ====== LCD screen ====== ====== LCD screen ======
  
Line 36: Line 36:
  
 <code c> <code c>
-// Example of using the graphic LCD of the HomeLab. +// Example of using the graphic LCD of the HomeLab 
-// Time of day is displayed on LCD since the beginning of the program.+// Time of day is displayed on LCD since the beginning of the program
 #include <stdio.h> #include <stdio.h>
 #include <homelab/module/lcd_gfx.h> #include <homelab/module/lcd_gfx.h>
 #include <homelab/delay.h> #include <homelab/delay.h>
  
-// Main program.+// Main program
 int main(void) int main(void)
 { {
Line 48: Line 48:
  char text[16];  char text[16];
  
- // Set-up of the LCD.+ // Set-up of the LCD
  lcd_gfx_init();  lcd_gfx_init();
  
- // Cleaning the screen.+ // Cleaning the screen
  lcd_gfx_clear();  lcd_gfx_clear();
  
- // Switching on the background light.+ // Switching on the background light
  lcd_gfx_backlight(true);   lcd_gfx_backlight(true);
  
- // Displaying the name of the program.+ // Displaying the name of the program
  lcd_gfx_goto_char_xy(1, 1);  lcd_gfx_goto_char_xy(1, 1);
  lcd_gfx_write_string("Time counter");  lcd_gfx_write_string("Time counter");
  
- // Endless loop. + // Endless loop
  while (true)  while (true)
  {  {
- // Converting the seconds to the form of clock.+ // Converting the seconds to the form of clock
  // hh:mm:ss  // hh:mm:ss
  sprintf(text, "%02d:%02d:%02d",  sprintf(text, "%02d:%02d:%02d",
Line 71: Line 71:
  seconds % 60);  seconds % 60);
  
- // Displaying the clock text.+ // Displaying the clock text
  lcd_gfx_goto_char_xy(3, 3);  lcd_gfx_goto_char_xy(3, 3);
  lcd_gfx_write_string(text);  lcd_gfx_write_string(text);
   
- // Adding one second.+ // Adding one second
  seconds++;  seconds++;
   
- // Hardware delay for 1000 ms.+ // Hardware delay for 1000 ms
  hw_delay_ms(1000);  hw_delay_ms(1000);
  }  }
 } }
 </code> </code>
en/examples/display/lcd.1446723792.txt.gz · Last modified: 2020/07/20 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0