If you have a brand spanking new Attiny84 you’ll need to change the fuses in order to get the timing right.

In AVR Studio you can change fuses in the Device Programming Window:


#define F_CPU 8000000 // I also disable the CLKDIV8 fuse //

#include <avr/io.h>

#include <util/delay.h> // because I'm using _delay_ms() //

int main(void)
{
DDRA = 0b11111111; // All port A pins set to output

while (1) // while value inside the brackets is non-zero,
{
PORTA = 0b11111111; // All port A pins HIGH
_delay_ms(1000); //1000ms = 1 second

PORTA = 0b00000000; // All port A pins LOW
_delay_ms(1000);
}
return (0);
}



The only thing to remember here is to first declare the pins to be outputs before setting them to high. Most AVR registers default to 0, so the DDRx registers are by default set to all inputs. To change that you need to write 1’s to the pins in that register. You can think of a register as a series of 8 switches, just like this guy:

These are the two registers you are changing: DDRx to set the pin as an output, PORTx to send it HIGH.