I have a working USBasp which is uploading sketches to an ATtiny13A and using a simple blink sketch. The LED ON part is working fine, staying on for 2 seconds, but after turning the LED off, the second _delay_ms
has no effect. The LED is off for a fraction of a second, and then it comes on again for the correct _delay_ms
.
#include <avr/io.h>
#include <util/delay.h>
int main(void)
{
DDRB = 0xFF;
while(1) {
PORTB |= (1 << PB0);
_delay_ms(2000);
PORTB &= ~(1 << PB0);
_delay_ms(20000);
}
}
arduino-cli compile -e --fqbn MicroCore:avr:13 Blink
arduino-cli upload --fqbn MicroCore:avr:13 --programmer usbasp Blink
No matter what the second _delay_ms
value is, the LED only briefly goes off before coming back on for the correct 2 seconds.
It is a standard red LED with a 200 ohm resistor connected to PB0 and GND, and 5 V in from the USBasp.