Im trying to use this code to turn LED's on and off via serial. The only problem is that i can't get them to go off on their own, the only way to do it is by resetting tha arduino. Does anyone know how to change the code to turn them off via serial?
Or is there a better code that someone knows to use?
void setup(){
Serial.begin(9600);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
}
void loop (){
if (Serial.available()) {
char ser = Serial.read();
switch (ser) {
case '3':
triggerPin(5);
break;
case '4':
triggerPin(6);
break;
}
}
}
void triggerPin(int pin){
digitalWrite(pin, HIGH);
}