Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void scrollMessage( char *str )
- {
- char msg[] = "123456789";
- const uint8_t width = 4;
- char vram[width];
- int8_t pos = 0;
- pos -= width;
- while (1)
- {
- for ( int8_t ramPos = 0 ; ramPos < width - 1; ramPos++ )
- {
- if ( (pos + ramPos) < 0 )
- {
- vram[ramPos] = 11; // Leerzeichen
- }
- else if ( (pos + ramPos) > strlen(msg) - 1 )
- {
- vram[ramPos] = 11; // Leerzeichen
- }
- else
- {
- vram[ramPos] = msg[ pos + ramPos ] - '0';
- }
- if( pos == strlen(msg) + width )
- {
- pos = -width;
- }
- else
- {
- pos += 1;
- }
- }
- for ( uint8_t i = 0 ; i < 4 ; i++ )
- {
- disp.dig[i] = vram[i];
- _delay_ms(250);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement