ATtiny13 – Blinken mit delay Funktion
Benötigte Bauteile
- AtTiny13
- 220 Ohm Widerstand
- LED an Port 5
#include <avr/io.h>
#include <util/delay.h>
#define LED_PIN PB0 // PB0 as a LED pin
int
main(void)
{
/* setup */
DDRB = 0b00000001; // set LED pin as OUTPUT
PORTB = 0b00000000; // set all pins to LOW
/* loop */
while (1) {
PORTB ^= _BV(LED_PIN); // toggle LED pin
_delay_ms(500);
}
}