char x;

 

void setup()

{

for(int i=6; i<=12; i++){

pinMode(i, OUTPUT);

}

Serial.begin(9600);

Serial.print(“Inserisci una delle lettere della parola ciao”);

}

 

void loop()

{

if(Serial.available()){

x=Serial.read();

}

switch(x){

case ‘c’:

blinkoff();

blink(11,10,9,8,0,0,0);

break;

case ‘i’:

blinkoff();

blink(0,10,9,0,0,0,0);

break;

case ‘a’:

blinkoff();

blink(6,7,9,10,11,12,0);

    break;

case ‘o’:

blinkoff();

blink(7,8,9,10,11,12,0);

break;

}

 

}

 

void blink(int a, int b, int c, int d, int e, int f, int g){

digitalWrite(a, HIGH);

digitalWrite(b, HIGH);

digitalWrite(c, HIGH);

digitalWrite(d, HIGH);

digitalWrite(e, HIGH);

digitalWrite(f, HIGH);

digitalWrite(g, HIGH);

}

 

void blinkoff(){

digitalWrite(6, LOW);

digitalWrite(7, LOW);

digitalWrite(8, LOW);

digitalWrite(9, LOW);

digitalWrite(10, LOW);

digitalWrite(11, LOW);

digitalWrite(12, LOW);

}