Advertisement
jh_elec

Untitled

Jun 9th, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 KB | None | 0 0
  1. void scrollMessage( char *str )
  2. {
  3.     char msg[] = "1234";
  4.     const uint8_t digits = 4;
  5.     int8_t pos = 0;
  6.     pos -= digits;
  7.    
  8.     for ( uint8_t i = 0 ; i < digits - 1 ; i++ )
  9.     {
  10.         if ( (pos + i) < 0 )
  11.         {
  12.             disp.dig[i] = 11; // Leerzeichen
  13.         }
  14.         else if ( pos + i > strlen(msg) - 1 )
  15.         {
  16.             disp.dig[i] = 11; // Leerzeichen
  17.         }
  18.         else
  19.         {
  20.             disp.dig[i] = msg[ pos + i ];
  21.         }
  22.         _delay_ms(500);
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement