Paso 5: código
redPin int = 9;
int greenPin = 10;
bluePin int = 11; bytes
com = 0; respuesta de reconocimiento de voz
void setup() {Serial.begin(9600);
pinMode (redPin, salida);
pinMode (greenPin, salida);
pinMode (bluePin, salida);
Delay(2000);
Serial.Write(0xAA);
Serial.Write(0x37);
Delay(1000);
Serial.Write(0xAA);
Serial.Write(0x21);
}
void loop()
{
while(serial.Available())
{
com = Serial.read();
Switch(com)
{
caso 0x11:
digitalWrite (redPin, HIGH);
rotura;
caso 0x12:
digitalWrite (greenPin, HIGH);
rotura;
caso 0 x 13:
digitalWrite (bluePin, HIGH);
rotura;
caso 0x14:
digitalWrite (redPin, HIGH);
digitalWrite (greenPin, HIGH);
digitalWrite (bluePin, HIGH);
rotura;
caso 0x15:
digitalWrite (redPin, LOW);
digitalWrite (greenPin, bajo);
digitalWrite (bluePin, LOW);
rotura;
}
}
}