Skip to content

Instantly share code, notes, and snippets.

@avr-programmierung
Created May 14, 2019 09:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avr-programmierung/fc681b7ea4779cc142abac1a175c8c32 to your computer and use it in GitHub Desktop.
Save avr-programmierung/fc681b7ea4779cc142abac1a175c8c32 to your computer and use it in GitHub Desktop.
ATmega88 @ 8MHz 08
/* code008.c ATmega88 @ 8MHz */
#include <avr/io.h>
#define LED1 (PORTD |= (1<<PD0)) // Ersetze (PORTD |= (1<<PD0)) durch LED1
#define LED2 (PORTD |= (1<<PD1)) // Ersetze (PORTD |= (1<<PD1)) durch LED2
#define LED3 (PORTD |= (1<<PD2)) // Ersetze (PORTD |= (1<<PD2)) durch LED3
uint8_t zahl = 1;
int main(void)
{
DDRD = 0xFF; // Richtungsregister gesamtes PORTD auf Ausgang
while(1)
{
if (zahl == 1)
LED1;
else if (zahl == 2)
LED2;
else
LED3;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment