I'm trying to squeeze code onto an ATtiny10, but I'm just not getting there. I'm using 1060 bytes and only have space for 1024 bytes.
The code is simple enough; I need to read a button pin. If high it needs to pick a random value and that causes one of two random LEDs on the PCB to turn on for two seconds. Is there a way to optimize this code to work on this IC?
int buttonState = 0;
void setup() {
pinMode(3, INPUT);
}
void loop() {
buttonState = digitalRead(3);
if (buttonState == HIGH) {
bool ranNum=random(0,1);
if(ranNum == 0) {
digitalWrite(0, HIGH);
}
else {
digitalWrite(1, HIGH);
}
delay(2000);
digitalWrite(1, LOW);
digitalWrite(2, LOW);
}
}