Push button timed audio and disco ball

Very new to Arduinos,

I'm wanting to have a push button that plays audio for about 1min and also activates a 230V led disco ball for 1min as well.

Any further pressing of the button while the display is active won't reset and play the audio file until the 1min is up.

This might be super basic but any help for this beginner would be much appreciated :slight_smile:

  • What hardware do you have ?

hey mate, I have the 4 relays shield and the uno R4 minima

  • Is one of these relays supposed to turn ON a music player of some kind ?

Not the best of choices. As the output current is limited to a maximum of 8mA per pin.

How do you plan to wire this up?
Please post a schematic..

You might want to look at this How to get the best out of this forum before you proceed any further.

Hello akalmand

Welcome to the best Arduino forum ever :slight_smile:

Start by designing a system block diagram.
This block diagram contains all hardware components and their dependencies.
The physical and logical properties of the interfaces are identified, as well as the respective energy consumption.
In the next step start with sketch design using the hardware design given.

hth

Hey guys,

Basically I just need to work out a script for a 2 pin button to operate the relays for 30 seconds without being able to reset the script by pushing the button again in that 30 seconds.

Here's my attempt at a script:

int relay_1 = 4;
int relay_2 = 7;
int buttonState = 0;
const int buttonPin = 9;

void setup() {
  
  Serial.begin(9600);

  pinMode(relay_1, OUTPUT);
  pinMode(relay_2, OUTPUT);
  pinMode(buttonPin, INPUT);
}

void loop() {

buttonState = digitalRead(buttonPin);
if (buttonState = HIGH) 
    // Push button, turn Relays on for 30 seconds:
    digitalWrite(relay_1, HIGH);
    digitalWrite(relay_2, HIGH);
  
    Serial.println("relays ON");
    delay(30000);
  
    // turn Relays off:
    digitalWrite(relay_1, LOW);
    digitalWrite(relay_2, LOW);
    Serial.println("relays OFF");
}
  • This is the first problem.

  • You will be wanting if (buttonState == HIGH)

  • How is the switch wired ?

  • What relay do you have ?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.