I needed 6 pins, and since my prefered chip ATMega328, 168, and 88 in TQFP-32 packages are all out of stock on 2 of my favorite part sites I am using ATTiny84 as the next alternative since I do have SOIC-16 versions on hand.
void loop() {
for (int i = 0; i <= 100; i++) {
for (int j = 0; j <= 5; j++) {
analogWrite(LED[j], (random(255));
}
delay(500);
}
// do something else after loop of 100 is done
}
This was originally how I planned, the 6 outputs would be set in LED[ x ] array to use the 6 PWM pins. ATtiny84 has only 2 PWM pins and some of the info I found via Google involves manually hammering the pin's output with short delay between high and low to simulate duty %. This won't work if I am trying to randomly set 6 LEDs brightness, changing every half second. Is there a software PWM library that will work with ATTiny or an alternate PWM trick? The other alternative is to use my Mega2560 which does have many PWM pins but it seems silly to use a big Arduino board for just 6 LEDs.