/******************************************************************************* * * HB 05 - Led acende por comunicação serial * Sugerido por Nathália Lima Celso * http://squids.com.br/arduino * ******************************************************************************/ int pinLed[] = {12,11,10,9,8,7,6,5,4,3}; //define o array c/ 10 elementos void setup() { Serial.begin(9600); // put your setup code here, to run once: for (byte i = 0; i<10; i++) { pinMode(pinLed[i], OUTPUT); } Serial.println("Digite um numero de 0 a 9"); } // end setup void loop() { // put your main code here, to run repeatedly: if (Serial.available()) { for (byte i = 0; i<10; i++) { digitalWrite(pinLed[i], LOW); } int number = Serial.parseInt(); digitalWrite(pinLed[number], HIGH); Serial.print("Received: "); Serial.println(number); } } // end loop