Sketch stops running.

Hello.

I was making a circuit when, suddenly, my arduino stopped running the sketch. I disconnected all the cables and it worked just fine. But, as soon as I re-connect the wires, it stops working.

Please help!

Thanks.

Sergio.

Perhaps you’ve got a faulty circuit.
Who knows?

Z3RG10: I was making a circuit when, suddenly, my arduino stopped running the sketch. I disconnected all the cables and it worked just fine. But, as soon as I re-connect the wires, it stops working.

Certainly sounds like part of the circuit is causing the problem. You should add cables one at a time to see if you can pinpoint which one causes the failure.

johnwasser: Certainly sounds like part of the circuit is causing the problem. You should add cables one at a time to see if you can pinpoint which one causes the failure.

The 13 led in my board was turned on, but when I tried to plug a wire to 13, it turns off, and the sketch stops running.

What does your sketch do with Pin 13?

It turns it on for 9 seconds.

(deleted)

My sketch is like a traffic light. I connected a wire from pin 13 to a breadboard with a led on it.

But you did use a current limiting resistor, right?

(deleted)

But I think its not a problem with the led because it worked earlier. I think the problem is with the arduino itself becasue the built-in-light stops working too.

Z3RG10: But I think its not a problem with the led because it worked earlier. I think the problem is with the arduino itself becasue the built-in-light stops working too.

Sounds like you are pulling too much current from the pin. That will force the built-in LED to turn off, ven if Pin 13 is set to HIGH.

Ok Im going to expand a lot. The traffic light should work fine, but it has a button, if you press this button the red light should start flashing. Here the hardware and the sketch.

PD. I don't have yellow so I use blue instead.

  // Sets the VARs.
  //const int policeButton; // NOT FINISHED
  //int policeButtonState = 0;// NOT FINISHED
  
  const int green = 13;
  const int yellow = 12;
  const int red = 8;
  const int blinkButton = 2;
  
  int blinkButtonState = LOW;

void setup() {
  // Sets the values as output or input.
  //pinMode(policeButton, INPUT); //NOT FINISHED
  
  pinMode(green, OUTPUT);
  pinMode(yellow, OUTPUT);
  pinMode(red, OUTPUT);
  pinMode(blinkButton, INPUT);
}
void loop() {
  blinkButtonState = digitalRead(blinkButton);
  switch (blinkButtonState) {
  case HIGH:
  digitalWrite(red, HIGH);
  delay(1000);
  digitalWrite(red, LOW);
  delay(1000);
  case LOW:  
  // Makes the green light to turn on for 9seconds and then it turns it off.
  digitalWrite(green, HIGH);
  delay(9000);
  digitalWrite(green, LOW);
  
  // Makes the yellow light to turn on for 3seconds and then it turns it off.
  
  digitalWrite(yellow, HIGH);
  delay(3000);
  digitalWrite(yellow, LOW);
  
  // Makes the red light to turn on for 10seconds and then it turns it off.
  
  digitalWrite(red, HIGH);
  delay(10000);
  digitalWrite(red, LOW);
  break;
}
}

(deleted)

This is my circuit.

(deleted)

(deleted)

Thanks! I knew how a breadboard worked, but I got confused.

(deleted)