#include <avr/io.h>
#include <util/delay.h>
// LED is on pin 1
#define LED PB1
#define DELAY_MS 1000
int main ()
{
uint8_t high = 0;
uint16_t ms = 0;
// Setup LED pin for output in port B's direction register
DDRB |= (1 << LED);
// Set LED pin HIGH
PORTB |= (1 << LED);
while (1) {
if (high) {
// Set LED pin HIGH
PORTB |= (1 << LED);
} else {
// Set LED pin LOW
PORTB &= ~(1 << LED);
}
high = !high;
// Delay for 1 second
for (ms = DELAY_MS; ms > 0; ms -= 10) {
_delay_ms(10);
}
}
return 0;
}
ERC Warnings
gate1:OUT: Multi-driven net on pin
gate2:OUT: Multi-driven net on pin