int myPins[]={3,4,5};
int pinCount = 3;
const long period = 300;
int smer = 1;
unsigned long start_time = 0;
int trenutnaled = 0;
int button = 2;
void setup() {
Serial.begin(9600);
randomSeed(analogRead(A0));
for(int thisPin=0; thisPin<pinCount;thisPin++){
pinMode(myPins[thisPin], OUTPUT);
pinMode(button, INPUT_PULLUP);
}
}
void loop() {
for (int i = 0 ; i < myPins; i++) {
digitalWrite(myPins[i], LOW);
}
delay(300);
int rand = random(0,3);
digitalWrite(myPins[rand], HIGH);
delay(300);
if (digitalRead(button) == LOW && rand == 1) {
Serial.print("Zedel");
}
else if (digitalRead(button) == LOW && rand != 1) {
Serial.print("Zgresil");
}
}