String eingabe;
int r = 3;
int g = 5;
int b = 6;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println("Farbwert?"); //Eingabe zb r;255
while(!Serial.available()) {}
String farbe = Serial.readStringUntil(';');
farbe.trim();
Serial.println(farbe);
int wert = Serial.readStringUntil(';').toInt();
Serial.println(wert);
if(farbe == "r")
{
analogWrite(r, wert);
delay(500);
analogWrite(r, 0);
}
if(farbe == "g")
{
analogWrite(g, wert);
delay(500);
analogWrite(g, 0);
}
if(farbe == "b")
{
analogWrite(6, wert);
delay(500);
analogWrite(6, 0);
}
}