Eine Version für die bee:

Code:
#include <avr/io.h>
#include <util/delay.h>
#include "lcd_lib.c"

#define taster_auf (lcd_getkeys()&1) // true wenn Taster gedrückt
#define taster_ab  (lcd_getkeys()&2)

uint16_t val = 0; // globale Variable für den Wert

void lcd_put_val(void) // val auf LCD ausgeben
{
	// lcd_setcursor(0, 0);
	// lcd_putdez_uint(val);
	lcd_locate(0, 0);
	lcd_writeInteger(val, 10);
	lcd_writeString("  ");
}

int main(void) {

	lcd_init();
	lcd_writeString("Hello");
	while(!taster_auf && !taster_ab);
	lcd_cls();
	while(taster_auf || taster_ab);
        lcd_put_val();
   
	while(1)
	{
		if(taster_auf && !taster_ab && (val<999))
		{
			val++;
			lcd_put_val();
			_delay_ms(300); // Startdelay
			while(taster_auf && !taster_ab && (val<995))
			{
				val+=5;
				lcd_put_val();
				_delay_ms(200); // Wiederholung
			}
		}

		if(!taster_auf && taster_ab && (val>0))
		{
			val--;
			lcd_put_val();
			_delay_ms(300);
			while(!taster_auf && taster_ab && (val>5))
			{
				val-=5;
				lcd_put_val();
				_delay_ms(200);
			}
		}
	}
	return 0;
}