Hello : I cannot find the problem with sketch "Switch Case 2". Entering a key stroke (a thru e) turns on the corresponding LED for only a micro second instead of remaining on.
ComPort matches. Iam using a Arduino Uno. Thanks
What have you got the line ending set to in the Serial monitor ? It looks to me as though it should be set to "No line ending" to avoid the CR and/or LF causing the default action in the switch/case to turn off the LEDs
What happens if you make this mod at the bottom of loop():
// other code above...
default:
// turn all the LEDs off:
for (int thisPin = 2; thisPin < 7; thisPin++) {
digitalWrite(thisPin, LOW);
}
}
delay(500);
}
}
UKHeliBob:
It looks to me as though it should be set to "No line ending" to avoid the CR and/or LF causing the default action in the switch/case to turn off the LEDs
I just verified that, by putting serial prints in the switch cases. It does indeed drop through to the default if the line end is other than "none". In fact with it set to both CR & LF, you get into the default twice.