My red led have some type of residual current

const int correcto1 = 2;
const int correcto2 = 3;
const int correcto3 = 4;
const int fallo1 = 5;
const int ledOk = 11;
const int ledError = 10;

bool is_correct1_cutted = false;
bool is_correct2_cutted = false;
bool is_correct3_cutted = false;



void setup() {
  pinMode(fallo1, INPUT);
  pinMode(correcto1, INPUT);
  pinMode(correcto2, INPUT);
  pinMode(correcto3, INPUT);
  pinMode(ledError, OUTPUT);
  pinMode(ledOk, OUTPUT);
}

void loop() {
  int estado_fallo1 = digitalRead(fallo1);
  int estado_correcto1 = digitalRead(correcto1);
  int estado_correcto2 = digitalRead(correcto2);
  int estado_correcto3 = digitalRead(correcto3);


  if (estado_fallo1 == LOW) {
    digitalWrite(ledError, HIGH);
    digitalWrite(ledOk, LOW);
    while(1);
  } else {
    digitalWrite(ledError, LOW);
  }

if (estado_correcto1 == LOW && (estado_correcto2 == HIGH && estado_correcto3 == HIGH))
  {
    is_correct1_cutted = true;
  }

 if (is_correct1_cutted && (estado_correcto2 == LOW && estado_correcto3 == HIGH))
  {
    is_correct2_cutted = true;
  }

if (is_correct1_cutted && (is_correct2_cutted && estado_correcto3 == LOW))
  {
    is_correct3_cutted = true;
  }

if (is_correct3_cutted == true)
  {
  digitalWrite(ledOk, HIGH);
  while (1);
  }

  if (estado_correcto1 == HIGH && (estado_correcto2 == LOW && estado_correcto3 == HIGH))
  {
    digitalWrite(ledError, HIGH);
  }
  
  if (estado_correcto1 == HIGH && (estado_correcto2 == HIGH && estado_correcto3 == LOW))
  {
    digitalWrite(ledError, HIGH);
  }
}

i've posted this program earlier about "cutting wires". this is the link:

the code works like:

I have 4 wires, 1 of them "fallo1" turns on a red led when "cutted out" meaning game over.
the other 3 wires it's neccesary to "cut them" in certain order (first correcto1, correcto2 and then correcto3).

if you "cut them" in any other order, it should turn on a red led.

My problem is when i "cut" (correcto1) everithing is okay, but when I cut the secon one, (correcto2 or correcto3) it turns on the red led but at half of the power.

Thanks for reading

Your inputs are connected incorrectly. When the wires are cut, the inputs will float and could read high or low randomly. I suspect this could make the code switch the red led on and off rapidly, making it appear to be lit dimly.

Wire them to ground, not 5V, and use INPUT_PULLUP. You will also need to change your code to check for LOW instead of HIGH and HIGH instead of LOW.

If You can use an oscilloscope and measure the controller output there might be short pulses from the controller that is the reason. Analysing Your code for that.... No, not today.
If You had been providing a flow chart, the design idea giving the overview, things had been easier.

Add some printing.

I'll bet that LED is being turnt on and off rapidly due to a logic error you haven't found yet.

Thus it appears half bright.

Put printing statements wherever you do digitalWrite() either LED,

    Serial.println(" turning on red LED at line 27");

kinda thing.

Printing is a primitive but essential tool for verifying the values of variables and confirming the flow in your program that those values inform.

a7

that was the problem, now it works perfectly

Your inputs are connected incorrectly. When the wires are cut, the inputs will float and could read high or low randomly. I suspect this could make the code switch the red led on and off rapidly, making it appear to be lit dimly.

Wire them to ground, not 5V, and use INPUT_PULLUP. You will also need to change your code to check for LOW instead of HIGH and HIGH instead of LOW.