PhotoBooth help.

Hi,

I have been working on a photobooth for a little while now. I am having a little trouble.

The user pushes a foot switch and a serial command is sent to the pc to start the photobooth software. At the same time using a transistor and relay the arduino turns a 12V led flash on and off four times to the timing of the photos taken in the software.

The trouble I am having is, I can get the lights to work sporadically but not all the time. I attached the schematic and the code. Can anyone tell me what I am doing wrong?

Thanks!

const int pedalPin = 2;
const int flashPin = 7;

int pedalState = 0;

void setup () {
  pinMode(pedalPin, INPUT);
  Serial.begin(9600);
  
  
  pinMode(flashPin, OUTPUT);
}

void loop () {
  pedalState = digitalRead(pedalPin);
  
  if (pedalState == HIGH) {
    //delay(1);
    
    
    Serial.println();
  }

if (pedalState == HIGH) {
    delay(3000);
    digitalWrite(flashPin, HIGH);
    delay(2000);
    digitalWrite(flashPin, LOW);
    delay(4000);
    digitalWrite(flashPin, HIGH);
    delay(2000);
    digitalWrite(flashPin, LOW);
    delay(4000);
    digitalWrite(flashPin, HIGH);
    delay(2000);
    digitalWrite(flashPin, LOW);
    delay(4000);
    digitalWrite(flashPin, HIGH);
    delay(2000);
    digitalWrite(flashPin, LOW);
  }
}

PhotoBooth Schematic.pdf (21.4 KB)

Are your grounds connected together?

One of the board grounds goes to the ground pin on the Uno and the other board ground goes into the second pin. The Power Supply Ground is only connected to the relay. None are connected to eachother. I don't know if it is relevant but I am piggybacking off the PC power supply as my external.

Should they be separated?

jjweber4540: Should they be separated?

No. They should ALL be connected together.