And $6.78 shipping to the U.S.
#include <avr/io.h>
int main(void)
{
/* enable the pull-up function */
PUEB |= 1<<PORTB1;
/* enable pull-up for button */
PORTB |= 1<<PORTB1;
/* configure LED pin as output */
DDRA |= 1<<DDRA5;
while (1)
{
/* check the button status (press - 0 , release - 1 ) */
if(!(PINB & (1<<PINB1)))
{
/*switch on the LED until button is pressed */
PORTA &= ~(1<<PORTA5);
}
else
{
/* switch off the LED if button is released*/
PORTA |= 1<<PORTA5;
}
}
}
by Jake Hertz
by Jeff Child
by Jake Hertz
by Aaron Carman