// allowed AVR Libraries
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/twi.h>
// Finish allowed AVR Libraries
// Allowed C-programming Libraries
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
// Finish allowed C-programming Libraries
int main(void)
{
PORTD = (1<<PORTD2); //PD2 is Button 1
PORTD = (1<<PORTD6); //PD6 is Button 2
DDRD = (1<<PORTD3)|(1<<PORTD4); // PD3 | PD4 PD3 is LED1 and PD4 is LED2
while(1) // DOUBLE LED CODE
{
if ((PIND & (1<<PIND2)) == (1<<PIND2) ) //Button 1 NOT pressed
{
PORTD |= (1<<PORTD3);
_delay_ms(500);
PORTD &= ~(1<<PORTD3);
_delay_ms(500);
}
else // Button 1 pressed
{
PORTD |= (1<<PORTD4);
_delay_ms(500);
PORTD &= ~(1<<PORTD4);
_delay_ms(500);
}
}
return(0);
}