heptagon-arduino/led.c

20 lines
351 B
C
Raw Normal View History

#include <avr/io.h>
#include <util/delay.h>
2020-12-14 20:22:04 +01:00
#define BLINK_DELAY_MS 4000
2020-12-14 20:22:04 +01:00
int main (void)
{
2020-12-14 20:28:18 +01:00
/* set pin 4 of PORTB for output*/
2020-12-14 20:22:04 +01:00
DDRB |= _BV(DDB4);
while(1) {
2020-12-14 20:28:18 +01:00
/* set pin 4 high to turn led on */
2020-12-14 20:22:04 +01:00
PORTB |= _BV(PORTB4);
_delay_ms(BLINK_DELAY_MS);
2020-12-14 20:28:18 +01:00
/* set pin 4 low to turn led off */
2020-12-14 20:22:04 +01:00
PORTB &= ~_BV(PORTB4);
_delay_ms(BLINK_DELAY_MS);
}
}