Magician needs help with LED project

Hello friends and Arduino experts. This will probably be a simple solution for you and but for me... not so much... :slight_smile:

I am a full time magician who is interested in using my Arduino to help with timing... bare with me. I'm working on a trick that involves different secret moves depending on when a spectator ranomly says stop. With the current COVID situation, I'm unable to practice this on real live people.

I'm interested in creating a practice device consisting of an LED connected to a button. When the button is pushed the light will randomly light up somewhere between 1-10 seconds. Each time the button is pushed it will start over and light up at a different random time again between 1-10 seconds. Can you possibly help me write code for this?

Much appreciated in advance

Jason

Can you possibly help me write code for this?

To be clear, are you asking someone to write the code? If so please click on 'report to moderator' and ask this to be moved to gigs and collaborations and indicate how much you are willing to pay.

Hi Perry... lets try this then.. can you point me in the right direction of where to begin my research?

Yes, search this website. Do the examples in the IDE and the tutorials on here. There's loads of material for beginners, use it.

We are here for if you get stuck.

Good luck.

I guess the program will be the smallest challenge to solve.
But who will do the proper wiring?

const byte buttonPin = A0;
const byte ledPin = 13;

void setup() {
  Serial.begin(115200);
  randomSeed(analogRead(A3));
  pinMode(buttonPin, INPUT_PULLUP);
  pinMode(ledPin, OUTPUT);
  Serial.println(F("Press button to start"));
}

void loop() {
  if (digitalRead(buttonPin) == LOW)
  {
    Serial.println(F("key pressed"));
    digitalWrite(ledPin, LOW);
    long wait = random (1, 10 + 1) * 1000;
    Serial.print(F("wait "));
    Serial.print(wait);
    Serial.println(F(" milliseconds"));
    delay(wait);
    digitalWrite(ledPin, HIGH);
    Serial.println(F("Press button to start"));
  }
}