char rgb;
void setup() {
pinMode(A0, OUTPUT);
pinMode(A1, OUTPUT);
pinMode(A2, OUTPUT);
digitalWrite(A0, HIGH);
digitalWrite(A1, HIGH);
digitalWrite(A2, HIGH);
Serial.begin(9600);
Serial.println("Zadanie");
}
void loop() {
if(Serial.available())
{
rgb = Serial.read();
Serial.println(rgb);
delay(2);
while(Serial.available())
{
Serial.read();
}
if(rgb=='z')
{
digitalWrite(A0, HIGH);
digitalWrite(A1,LOW);
digitalWrite(A2, HIGH);
}
else if(rgb=='c')
{
digitalWrite(A0, HIGH);
digitalWrite(A1, HIGH);
digitalWrite(A2, LOW);;
}
else if(rgb=='m')
{
digitalWrite(A0, LOW);
digitalWrite(A1, HIGH);
digitalWrite(A2, HIGH);
}
else{
Serial.print("error");
}
}
}