#include <MD_MAX72xx.h>

// Turn on debug statements to the serial output
#define  DEBUG  1

#if  DEBUG
#define PRINT(s, x) { Serial.print(F(s)); Serial.print(x); }
#define PRINTS(x) Serial.print(F(x))
#define PRINTD(x) Serial.println(x, DEC)

#else
#define PRINT(s, x)
#define PRINTS(x)
#define PRINTD(x)

#endif

#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW/*PAROLA_HW/FC16_HW*/
#define MAX_DEVICES	14

#define CLK_PIN   13  // or SCK
#define DATA_PIN  11  // or MOSI
#define CS_PIN    10  // or SS

MD_MAX72XX mx = MD_MAX72XX(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
// Specific SPI hardware interface
//MD_MAX72XX mx = MD_MAX72XX(HARDWARE_TYPE, SPI1, CS_PIN, MAX_DEVICES);
// Arbitrary pins
//MD_MAX72XX mx = MD_MAX72XX(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);

#define  DELAYTIME  100  // in milliseconds

#define PULS1 9
#define PULS2 8
#define PULS3 7
#define PULS4 6
#define PULS5 5
#define PULS6 4
#define PULS7 3
#define PULS8 2
byte face=1;
short tempo;

void setup()
{
  mx.begin();

#if  DEBUG
  Serial.begin(3600);
#endif
  PRINTS("\[Test Protogen os]");
  if(!DEBUG) OSBoot();//se i debug è a 1 evito di avviare il booting per fare prima
}
void loop()
{
  if(DEBUG) Serial.println(face);//se il debug è a 1 controllo se cambia la variabile dela faccia
  tempo=0;
  switch(face){//a seconda di che pulsante si ha premuto entra in un caso della determinata faccia
    case 1:
      idleFace();//faccio vedere la faccia desiderata
      loopBlink(face);
      break;
    case 2: 
      happyFace();
      loopBlink(face);
      break;
    case 3:
      angyFace();
      loopBlink(face);
      break;
    case 4:
      playfulFace();
      loopBlink(face);
      break;
    case 5:
      sillyFace();//faccio vedere la faccia desiderata
      loopBlink(face);
      break;
    case 6:
      kinkyFace();//faccio vedere la faccia desiderata
      loopBlink(face);
      break;
    case 7:
      deathFace();//faccio vedere la faccia desiderata
      loopBlink(face);
      break;
    case 8:
      idleFace();//faccio vedere la faccia desiderata
      loopBlink(face);
      break;
  }
}

void idleFace(){//componenti della faccia di idle
  edgyEyes();
  normalNose();
  normalMouth();
  edgyEyesBlink();
}

void happyFace(){//componenti della faccia felice
  happyEyes();
  normalNose();
  normalMouth();
}

void angyFace(){//componenti della faccia arrabbiata
  angyEyes();
  normalNose();
  angyMouth();
  angyEyesBlink();
}

void playfulFace(){
  playfulEyes();
  normalNose();
  normalMouth();
}

void sillyFace(){
  owoEyes();
  normalNose();
  wMouth();
  owoEyesBlink();
}

void kinkyFace(){
  uwuEyes();
  normalNose();
  wMouth();
}

void deathFace(){
  deathEyes();
  normalNose();
  wMouth();
}

void loopBlink(byte x){
  while(tempo<=7000){//'delay' per essere recettivo e allo stesso tempo aspettare prima di fare il blink
    delay(1);
    if(digitalRead(PULS1)) face=1;//a seconda di quale pulsante è stato premuto cambia il dato da dare allo switch
    if(digitalRead(PULS2)) face=2;
    if(digitalRead(PULS3)) face=3;
    if(digitalRead(PULS4)) face=4;
    if(digitalRead(PULS5)) face=5;
    if(digitalRead(PULS6)) face=6;
    if(digitalRead(PULS7)) face=7;
    if(digitalRead(PULS8)) face=8;
    if(face!=x) {//se face cambia pulisce le matrici e fa uscire istantaneamente dal while
      mx.clear();
      tempo=7000;
    }
    tempo++;
  }
}

void OSBoot(){//funzione estetica di avvio del protogen
  scrollText("PROTOGEN OS 1.5 BOOTING");
  delay(200);//delay per leggere
  mx.clear();//pulisco le matrici per non compenetrare i pixel dei numeri precedenti
  mx.setChar(5, '3');//metto a pixel il numero 3
  delay(1000);//delay per simulare i secondi che passano
  mx.clear();
  mx.setChar(5, '2');
  delay(1000);
  mx.clear();
  mx.setChar(5, '1');
  delay(1000);
  mx.clear();
  mx.setChar(5, '0');
  delay(1000);
  mx.clear();
}


void scrollText(const char *p)//funzione per lo scorrimento orizzontale di parole
{
  uint8_t charWidth;
  uint8_t cBuf[8];  // this should be ok for all built-in fonts

  PRINTS("\nprotogen booting..");
  mx.clear();

  while (*p != '\0')
  {
    charWidth = mx.getChar(*p++, sizeof(cBuf) / sizeof(cBuf[0]), cBuf);

    for (uint8_t i=0; i<=charWidth; i++)	// allow space between characters
    {
      mx.transform(MD_MAX72XX::TSL);
      if (i < charWidth)
        mx.setColumn(0, cBuf[i]);
      delay(DELAYTIME);
    }
  }
}

void edgyEyesBlink(){
  PRINTS("\nedgy eyes blinking..");
  //ho dovuto mischiare lato destro e sinistro per colpa dei delay
  byte i, riga=1;
  for(i=32 ; i<48 ; i++){//spengo la 1/2 riga di entrambi gli occhi
    mx.setPoint(riga-1, i, false);
    mx.setPoint(riga, i, false);
  }
  for(i=64 ; i<80 ; i++){
    mx.setPoint(riga-1, i, false);
    mx.setPoint(riga, i, false);
  }
  delay(20);
  riga++;
  for(i=33 ; i<48 ; i++) mx.setPoint(riga, i, false);//spengo la 3 riga di entrambi gli occhi
  for(i=64 ; i<79 ; i++) mx.setPoint(riga, i, false);
  delay(20);
  riga++;
  riga++;
  for(i=35 ; i<47 ; i++) {//spengo la 4/5 riga di entrambi gli occhi
    mx.setPoint(riga-1, i, false);
    mx.setPoint(riga, i, false);
  }
  for(i=65 ; i<77 ; i++) {
    mx.setPoint(riga-1, i, false);
    mx.setPoint(riga, i, false);
  }
  delay(10);
  riga=7;
  for(i=39 ; i<43 ; i++) mx.setPoint(riga, i, false);//spengo la 6 riga di entrambi gli occhi
  for(i=69 ; i<73 ; i++) mx.setPoint(riga, i, false);
  delay(20);
  riga--;
  for(i=37 ; i<45 ; i++) mx.setPoint(riga, i, false);//spengo la 7 riga di entrambi gli occhi
  for(i=67 ; i<75 ; i++) mx.setPoint(riga, i, false);
  delay(20);
  riga--;
  for(i=36 ; i<46 ; i++) mx.setPoint(riga, i, false);//spengo la 8 riga di entrambi gli occhi
  for(i=66 ; i<76 ; i++) mx.setPoint(riga, i, false);
  delay(130);
  for(i=36 ; i<46 ; i++) mx.setPoint(riga, i, true);//accendo la 8 riga di entrambi gli occhi
  for(i=66 ; i<76 ; i++) mx.setPoint(riga, i, true);
  delay(20);
  riga++;
  for(i=37 ; i<45 ; i++) mx.setPoint(riga, i, true);//accendo la 7 riga di entrambi gli occhi
  for(i=67 ; i<75 ; i++) mx.setPoint(riga, i, true);
  delay(20);
  riga++;
  for(i=39 ; i<43 ; i++) mx.setPoint(riga, i, true);//accendo la 6 riga di entrambi gli occhi
  for(i=69 ; i<73 ; i++) mx.setPoint(riga, i, true);
  delay(20);
  riga=5;
  riga--;
  riga--;
  for(i=35 ; i<47 ; i++) {//accendo la 5/4 riga di entrambi gli occhi
    mx.setPoint(riga+1, i, true);
    mx.setPoint(riga, i, true);
  }
  for(i=65 ; i<77 ; i++) {
    mx.setPoint(riga+1, i, true);
    mx.setPoint(riga, i, true);
  }
  delay(20);
  riga--;
  for(i=33 ; i<48 ; i++) mx.setPoint(riga, i, true);//accendo la 3 riga di entrambi gli occhi
  for(i=64 ; i<79 ; i++) mx.setPoint(riga, i, true);
  delay(20);
  riga--;
  riga--;
  for(i=32 ; i<48 ; i++){//accendo la 2/1 di entrambi gli occhi
    mx.setPoint(riga+1, i, true);
    mx.setPoint(riga, i, true);
  }
  for(i=64 ; i<80 ; i++){
    mx.setPoint(riga+1, i, true);
    mx.setPoint(riga, i, true);
  }
}

void angyEyesBlink(){
  PRINTS("\nangy eyes blinking..");
  byte i, riga=0;
  for(i=32 ; i<35 ; i++) mx.setPoint(riga, i, false);//spengo la  riga di entrambi gli occhi
  for(i=77 ; i<80 ; i++) mx.setPoint(riga, i, false);
  delay(30);
  riga++;
  for(i=32 ; i<38 ; i++) mx.setPoint(riga, i, false);//spengo la 2 riga di entrambi gli occhi
  for(i=74 ; i<80 ; i++) mx.setPoint(riga, i, false);
  delay(30);
  riga++;
  for(i=33 ; i<41 ; i++) mx.setPoint(riga, i, false);//spengo la 3 riga di entrambi gli occhi
  for(i=71 ; i<79 ; i++) mx.setPoint(riga, i, false);
  delay(30);
  riga++;
  for(i=34 ; i<44 ; i++) mx.setPoint(riga, i, false);//spengo la 4 riga di entrambi gli occhi
  for(i=68 ; i<78 ; i++) mx.setPoint(riga, i, false);
  delay(30);
  riga++;
  for(i=34 ; i<46 ; i++) mx.setPoint(riga, i, false);//spengo la 5 riga di entrambi gli occhi
  for(i=66 ; i<78 ; i++) mx.setPoint(riga, i, false);
  delay(30);
  riga=7;
  for(i=37 ; i<45 ; i++) mx.setPoint(riga, i, false);//spengo la 6 riga di entrambi gli occhi
  for(i=67 ; i<75 ; i++) mx.setPoint(riga, i, false);
  delay(30);
  riga--;
  for(i=36 ; i<46 ; i++) mx.setPoint(riga, i, false);//spengo la 7 riga di entrambi gli occhi
  for(i=66 ; i<76 ; i++) mx.setPoint(riga, i, false);
  delay(30);
  riga--;
  for(i=35 ; i<47 ; i++) mx.setPoint(riga, i, false);//spengo la 8 riga di entrambi gli occhi
  for(i=65 ; i<77 ; i++) mx.setPoint(riga, i, false);
  delay(130);
  for(i=35 ; i<47 ; i++) mx.setPoint(riga, i, true);//accendo la 8 riga di entrambi gli occhi
  for(i=65 ; i<77 ; i++) mx.setPoint(riga, i, true);
  delay(30);
  riga++;
  for(i=36 ; i<46 ; i++) mx.setPoint(riga, i, true);//accendo la 7 riga di entrambi gli occhi
  for(i=66 ; i<76 ; i++) mx.setPoint(riga, i, true);
  delay(30);
  riga++;
  for(i=37 ; i<45 ; i++) mx.setPoint(riga, i, true);//accendo la 6 riga di entrambi gli occhi
  for(i=67 ; i<75 ; i++) mx.setPoint(riga, i, true);
  delay(30);
  riga=4;
  for(i=34 ; i<46 ; i++) mx.setPoint(riga, i, true);//accendo la 5 riga di entrambi gli occhi
  for(i=66 ; i<78 ; i++) mx.setPoint(riga, i, true);
  delay(30);
  riga--;
  for(i=34 ; i<44 ; i++) mx.setPoint(riga, i, true);//accendo la 4 riga di entrambi gli occhi
  for(i=68 ; i<78 ; i++) mx.setPoint(riga, i, true);
  delay(30);
  riga--;
  for(i=33 ; i<41 ; i++) mx.setPoint(riga, i, true);//accendo la 3 riga di entrambi gli occhi
  for(i=71 ; i<79 ; i++) mx.setPoint(riga, i, true);
  delay(30);
  riga--;
  for(i=32 ; i<38 ; i++) mx.setPoint(riga, i, true);//accendo la 2 riga di entrambi gli occhi
  for(i=74 ; i<80 ; i++) mx.setPoint(riga, i, true);
  delay(30);
  riga--;
  for(i=32 ; i<35 ; i++) mx.setPoint(riga, i, true);//accendo la 1 riga di entrambi gli occhi
  for(i=77 ; i<80 ; i++) mx.setPoint(riga, i, true);
}

void owoEyesBlink(){
  PRINTS("\nowo eyes blinking..");
  byte i, riga=0;
  for(i=38 ; i<42 ; i++) mx.setPoint(riga, i, false);
  for(i=70 ; i<74 ; i++) mx.setPoint(riga, i, false);
  delay(10);
  riga++;
  for(i=37 ; i<43 ; i++){
    if((i>=37 && i<=38) || (i>=41 && i<=42)) mx.setPoint(riga, i, false);
  }
  for(i=69 ; i<75 ; i++){
    if((i>=69 && i<=70) || (i>=73 && i<=74)) mx.setPoint(riga, i, false);
  }
  delay(10);
  riga++;
  for(i=36 ; i<44 ; i++){
    if((i>=36 && i<=37) || (i>=42 && i<=43)) mx.setPoint(riga, i, false);
  }
  for(i=68 ; i<76 ; i++){
    if((i>=68 && i<=69) || (i>=74 && i<=75)) mx.setPoint(riga, i, false);
  }
  delay(10);
  riga++;
  mx.setPoint(riga, 36, false);
  mx.setPoint(riga, 43, false);
  mx.setPoint(riga, 68, false);
  mx.setPoint(riga, 75, false);
  delay(10);
  riga++;
  mx.setPoint(riga, 36, false);
  mx.setPoint(riga, 43, false);
  mx.setPoint(riga, 68, false);
  mx.setPoint(riga, 75, false);
  delay(10);
  riga=7;
  for(i=38 ; i<42 ; i++) mx.setPoint(riga, i, false);
  for(i=70 ; i<74 ; i++) mx.setPoint(riga, i, false);
  delay(10);
  riga--;
  for(i=37 ; i<43 ; i++){
    if((i>=37 && i<=38) || (i>=41 && i<=42)) mx.setPoint(riga, i, false);
  }
  for(i=69 ; i<75 ; i++){
    if((i>=69 && i<=70) || (i>=73 && i<=74)) mx.setPoint(riga, i, false);
  }
  delay(10);
  riga--;
  for(i=36 ; i<44 ; i++){
    if((i>=36 && i<=37) || (i>=42 && i<=43)) mx.setPoint(riga, i, false);
  }
  for(i=68 ; i<76 ; i++){
    if((i>=68 && i<=69) || (i>=74 && i<=75)) mx.setPoint(riga, i, false);
  }
  delay(130);///////////////////////////////////////////////////////
  for(i=36 ; i<44 ; i++){
    if((i>=36 && i<=37) || (i>=42 && i<=43)) mx.setPoint(riga, i, true);
  }
  for(i=68 ; i<76 ; i++){
    if((i>=68 && i<=69) || (i>=74 && i<=75)) mx.setPoint(riga, i, true);
  }
  delay(10);
  riga++;
  for(i=37 ; i<43 ; i++){
    if((i>=37 && i<=38) || (i>=41 && i<=42)) mx.setPoint(riga, i, true);
  }
  for(i=69 ; i<75 ; i++){
    if((i>=69 && i<=70) || (i>=73 && i<=74)) mx.setPoint(riga, i, true);
  }
  delay(10);
  riga++;
  for(i=38 ; i<42 ; i++) mx.setPoint(riga, i, true);
  for(i=70 ; i<74 ; i++) mx.setPoint(riga, i, true);
  delay(10);
  riga=4;
  mx.setPoint(riga, 36, true);
  mx.setPoint(riga, 43, true);
  mx.setPoint(riga, 68, true);
  mx.setPoint(riga, 75, true);
  delay(10);
  riga--;
  mx.setPoint(riga, 36, true);
  mx.setPoint(riga, 43, true);
  mx.setPoint(riga, 68, true);
  mx.setPoint(riga, 75, true);
  delay(10);
  riga--;
  for(i=36 ; i<44 ; i++){
    if((i>=36 && i<=37) || (i>=42 && i<=43)) mx.setPoint(riga, i, true);
  }
  for(i=68 ; i<76 ; i++){
    if((i>=68 && i<=69) || (i>=74 && i<=75)) mx.setPoint(riga, i, true);
  }
  delay(10);
  riga--;
  for(i=37 ; i<43 ; i++){
    if((i>=37 && i<=38) || (i>=41 && i<=42)) mx.setPoint(riga, i, true);
  }
  for(i=69 ; i<75 ; i++){
    if((i>=69 && i<=70) || (i>=73 && i<=74)) mx.setPoint(riga, i, true);
  }
  delay(10);
  riga--;
  for(i=38 ; i<42 ; i++) mx.setPoint(riga, i, true);
  for(i=70 ; i<74 ; i++) mx.setPoint(riga, i, true);
}

void happyEyes(){
  PRINTS("\nhappy eyes blinking..");
  byte i, riga=0;
  for(i=40 ; i<44 ; i++) mx.setPoint(riga, i, true);//accendo la 1 riga dell'occhio destro
  for(i=68 ; i<72 ; i++) mx.setPoint(riga, i, true);//accendo la 1 riga dell'occhio sinistro
  riga++;
  for(i=37 ; i<46 ; i++) mx.setPoint(riga, i, true);//accendo la 2 riga dell'occhio destro
  for(i=66 ; i<75 ; i++) mx.setPoint(riga, i, true);//accendo la 2 riga dell'occhio sinistro
  riga++;
  for(i=35 ; i<47 ; i++) mx.setPoint(riga, i, true);//accendo la 3 riga dell'occhio destro
  for(i=65 ; i<77 ; i++) mx.setPoint(riga, i, true);//accendo la 3 riga dell'occhio sinistro
  riga++;
  for(i=33 ; i<48 ; i++) mx.setPoint(riga, i, true);//accendo la 4 riga dell'occhio destro
  for(i=64 ; i<79 ; i++) mx.setPoint(riga, i, true);//accendo la 4 riga dell'occhio sinistro
  riga++;
  for(i=32 ; i<49 ; i++){//accendo la 5 riga dell'occhio destro
    if((i>=32 && i<=34) || (i>=44 && i<=47)) mx.setPoint(riga, i, true);
  }
  for(i=64 ; i<80 ; i++){//accendo la 5 riga dell'occhio sinistro
    if((i>=64 && i<=67) || (i>=77 && i<=79)) mx.setPoint(riga, i, true);
  }
  riga++;
  for(i=0 ; i<48 ; i++){//accendo la 6 riga dell'occhio destro
    if((i==32) || (i>=45 && i<=46))mx.setPoint(riga, i, true);
  }
  for(i=65 ; i<80 ; i++){//accendo la 6 riga dell'occhio sinistro
    if((i==79) || (i>=65 && i<=66)) mx.setPoint(riga, i, true);
  }
  //non ci sono riga 7/8 perchè sono spente
  PRINTS("\nhappy eyes done");
}

void edgyEyes(){
  PRINTS("\nedgy eye booting..");
  byte i, riga=1;
  for(i=32 ; i<48 ; i++){
    mx.setPoint(riga-1, i, true);
    mx.setPoint(riga, i, true);
  }
  for(i=64 ; i<80 ; i++){
    mx.setPoint(riga-1, i, true);
    mx.setPoint(riga, i, true);
  }
  riga++;
  for(i=33 ; i<48 ; i++) mx.setPoint(riga, i, true);
  for(i=64 ; i<79 ; i++) mx.setPoint(riga, i, true);
  riga++;
  riga++;
  for(i=35 ; i<47 ; i++) {
    mx.setPoint(riga-1, i, true);
    mx.setPoint(riga, i, true);
  }
  for(i=65 ; i<77 ; i++) {
    mx.setPoint(riga-1, i, true);
    mx.setPoint(riga, i, true);
  }
  riga++;
  for(i=36 ; i<46 ; i++) mx.setPoint(riga, i, true);
  for(i=66 ; i<76 ; i++) mx.setPoint(riga, i, true);
  riga++;
  for(i=37 ; i<45 ; i++) mx.setPoint(riga, i, true);
  for(i=67 ; i<75 ; i++) mx.setPoint(riga, i, true);
  riga++;
  for(i=39 ; i<43 ; i++) mx.setPoint(riga, i, true);
  for(i=69 ; i<73 ; i++) mx.setPoint(riga, i, true);
  PRINTS("\nedgy eye done");
}

void angyEyes(){
  PRINTS("\nangy eyes booting..");
  byte i, riga=0;
  for(i=32 ; i<35 ; i++) mx.setPoint(riga, i, true);
  for(i=77 ; i<80 ; i++) mx.setPoint(riga, i, true);
  riga++;
  for(i=32 ; i<38 ; i++) mx.setPoint(riga, i, true);
  for(i=74 ; i<80 ; i++) mx.setPoint(riga, i, true);
  riga++;
  for(i=33 ; i<41 ; i++) mx.setPoint(riga, i, true);
  for(i=71 ; i<79 ; i++) mx.setPoint(riga, i, true);
  riga++;
  for(i=34 ; i<44 ; i++) mx.setPoint(riga, i, true);
  for(i=68 ; i<78 ; i++) mx.setPoint(riga, i, true);
  riga++;
  for(i=34 ; i<46 ; i++) mx.setPoint(riga, i, true);
  for(i=66 ; i<78 ; i++) mx.setPoint(riga, i, true);
  riga++;
  for(i=35 ; i<47 ; i++) mx.setPoint(riga, i, true);
  for(i=65 ; i<77 ; i++) mx.setPoint(riga, i, true);
  riga++;
  for(i=36 ; i<46 ; i++) mx.setPoint(riga, i, true);
  for(i=66 ; i<76 ; i++) mx.setPoint(riga, i, true);
  riga++;
  for(i=37 ; i<45 ; i++) mx.setPoint(riga, i, true);
  for(i=67 ; i<75 ; i++) mx.setPoint(riga, i, true);
  PRINTS("\nangy eyes done");
}

void playfulEyes(){
  PRINTS("\nplayful eyes booting..");
  byte i, riga=0;
  for(i=33 ; i<37 ; i++) mx.setPoint(riga, i, true);
  for(i=75 ; i<79 ; i++) mx.setPoint(riga, i, true);
  riga++;
  for(i=36 ; i<40 ; i++) mx.setPoint(riga, i, true);
  for(i=72 ; i<76 ; i++) mx.setPoint(riga, i, true);
  riga++;
  for(i=39 ; i<43 ; i++) mx.setPoint(riga, i, true);
  for(i=69 ; i<73 ; i++) mx.setPoint(riga, i, true);
  riga++;
  for(i=42 ; i<46 ; i++) mx.setPoint(riga, i, true);
  for(i=66 ; i<70 ; i++) mx.setPoint(riga, i, true);
  riga++;
  for(i=45 ; i<48 ; i++) mx.setPoint(riga, i, true);
  for(i=64 ; i<67 ; i++) mx.setPoint(riga, i, true);
  riga++;
  for(i=42 ; i<46 ; i++) mx.setPoint(riga, i, true);
  for(i=66 ; i<70 ; i++) mx.setPoint(riga, i, true);
  riga++;
  for(i=39 ; i<43 ; i++) mx.setPoint(riga, i, true);
  for(i=69 ; i<73 ; i++) mx.setPoint(riga, i, true);
  riga++;
  for(i=36 ; i<40 ; i++) mx.setPoint(riga, i, true);
  for(i=72 ; i<76 ; i++) mx.setPoint(riga, i, true);
  PRINTS("\nplayful eyes done");
}
  
void owoEyes(){
  PRINTS("\nowo eyes booting..");
  byte i, riga=0;
  for(i=38 ; i<42 ; i++) mx.setPoint(riga, i, true);
  for(i=70 ; i<74 ; i++) mx.setPoint(riga, i, true);
  riga++;
  for(i=37 ; i<43 ; i++){
    if((i>=37 && i<=38) || (i>=41 && i<=42)) mx.setPoint(riga, i, true);
  }
  for(i=69 ; i<75 ; i++){
    if((i>=69 && i<=70) || (i>=73 && i<=74)) mx.setPoint(riga, i, true);
  }
  riga++;
  for(i=36 ; i<44 ; i++){
    if((i>=36 && i<=37) || (i>=42 && i<=43)) mx.setPoint(riga, i, true);
  }
  for(i=68 ; i<76 ; i++){
    if((i>=68 && i<=69) || (i>=74 && i<=75)) mx.setPoint(riga, i, true);
  }
  riga++;
  mx.setPoint(riga, 36, true);
  mx.setPoint(riga, 43, true);
  mx.setPoint(riga, 68, true);
  mx.setPoint(riga, 75, true);
  riga++;
  mx.setPoint(riga, 36, true);
  mx.setPoint(riga, 43, true);
  mx.setPoint(riga, 68, true);
  mx.setPoint(riga, 75, true);
  riga++;
  for(i=36 ; i<44 ; i++){
    if((i>=36 && i<=37) || (i>=42 && i<=43)) mx.setPoint(riga, i, true);
  }
  for(i=68 ; i<76 ; i++){
    if((i>=68 && i<=69) || (i>=74 && i<=75)) mx.setPoint(riga, i, true);
  }
  riga++;
  for(i=37 ; i<43 ; i++){
    if((i>=37 && i<=38) || (i>=41 && i<=42)) mx.setPoint(riga, i, true);
  }
  for(i=69 ; i<75 ; i++){
    if((i>=69 && i<=70) || (i>=73 && i<=74)) mx.setPoint(riga, i, true);
  }
  riga++;
  for(i=38 ; i<42 ; i++) mx.setPoint(riga, i, true);
  for(i=70 ; i<74 ; i++) mx.setPoint(riga, i, true);
  PRINTS("\nowo eyes done");
}

void uwuEyes(){
  PRINTS("\nuwu eyes booting..");
  byte i, riga=0;
  for(riga ; riga<4 ; riga++){
    mx.setPoint(riga, 36, true);
    mx.setPoint(riga, 43, true);
    mx.setPoint(riga, 68, true);
    mx.setPoint(riga, 75, true);
  }
  for(i=36 ; i<44 ; i++){
    if((i>=36 && i<=37) || (i>=42 && i<=43)) mx.setPoint(riga, i, true);
  }
  for(i=68 ; i<76 ; i++){
    if((i>=68 && i<=69) || (i>=74 && i<=75)) mx.setPoint(riga, i, true);
  }
  riga++;
  mx.setPoint(riga, 37, true);
  mx.setPoint(riga, 42, true);
  mx.setPoint(riga, 69, true);
  mx.setPoint(riga, 74, true);
  riga++;
  for(i=37 ; i<43 ; i++){
    if((i>=37 && i<=38) || (i>=41 && i<=42)) mx.setPoint(riga, i, true);
  }
  for(i=69 ; i<75 ; i++){
    if((i>=69 && i<=70) || (i>=73 && i<=74)) mx.setPoint(riga, i, true);
  }
  riga++;
  for(i=38 ; i<42 ; i++){
    if(i>=38 && i<=41) mx.setPoint(riga, i, true);
  }
  for(i=70 ; i<74 ; i++){
    if(i>=70 && i<=73) mx.setPoint(riga, i, true);
  }
  PRINTS("\nuwu eyes done");
}

void deathEyes(){
  PRINTS("\ndeath eyes booting..");
  byte i, riga=0;
  for(i=32 ; i<48 ; i++){
    if((i>=32 && i<=35) || (i>=44 && i<=47)) mx.setPoint(riga, i, true);
  }
  for(i=64 ; i<80 ; i++){
    if((i>=64 && i<=67) || (i>=76 && i<=79)) mx.setPoint(riga, i, true);
  }
  riga++;
  for(i=34 ; i<46 ; i++){
    if((i>=34 && i<=37) || (i>=42 && i<=45)) mx.setPoint(riga, i, true);
  }
  for(i=66 ; i<79 ; i++){
    if((i>=66 && i<=69) || (i>=74 && i<=77)) mx.setPoint(riga, i, true);
  }
  riga++;
  for(i=35 ; i<45 ; i++){
    if((i>=35 && i<=38) || (i>=41 && i<=44)) mx.setPoint(riga, i, true);
  }
  for(i=67 ; i<77 ; i++){
    if((i>=67 && i<=70) || (i>=73 && i<=76)) mx.setPoint(riga, i, true);
  }
  riga++;
  for(i=37 ; i<43 ; i++) mx.setPoint(riga, i, true);
  for(i=69 ; i<75 ; i++) mx.setPoint(riga, i, true);
  riga++;
  for(i=37 ; i<43 ; i++) mx.setPoint(riga, i, true);
  for(i=69 ; i<75 ; i++) mx.setPoint(riga, i, true);
  riga++;
  for(i=35 ; i<45 ; i++){
    if((i>=35 && i<=38) || (i>=41 && i<=44)) mx.setPoint(riga, i, true);
  }
  for(i=67 ; i<77 ; i++){
    if((i>=67 && i<=70) || (i>=73 && i<=76)) mx.setPoint(riga, i, true);
  }
  riga++;
  for(i=34 ; i<46 ; i++){
    if((i>=34 && i<=37) || (i>=42 && i<=45)) mx.setPoint(riga, i, true);
  }
  for(i=66 ; i<79 ; i++){
    if((i>=66 && i<=69) || (i>=74 && i<=77)) mx.setPoint(riga, i, true);
  }
  riga++;
  for(i=32 ; i<48 ; i++){
    if((i>=32 && i<=35) || (i>=44 && i<=47)) mx.setPoint(riga, i, true);
  }
  for(i=64 ; i<80 ; i++){
    if((i>=64 && i<=67) || (i>=76 && i<=79)) mx.setPoint(riga, i, true);
  }
  PRINTS("\ndeath eyes done");
}

void normalNose(){
  PRINTS("\nnormal nose booting..");
  byte i, riga=0;
  for(i=48 ; i<55 ; i++)  mx.setPoint(riga, i, true);
  for(i=57 ; i<64 ; i++)  mx.setPoint(riga, i, true);
  riga++;
  for(i=49 ; i<56 ; i++)  mx.setPoint(riga, i, true);
  for(i=56 ; i<63 ; i++)  mx.setPoint(riga, i, true);
  riga++;
  for(riga ; riga<5 ; riga++){
    for(i=54 ; i<56 ; i++)  {
      mx.setPoint(riga, i, true);
    }
    for(i=56 ; i<58 ; i++)  {
      mx.setPoint(riga, i, true);
    }
  }
  mx.setPoint(riga, 55, true);
  mx.setPoint(riga, 56, true);
  PRINTS("\nnormal nose done");
}

void normalMouth(){
  PRINTS("\nnormal mouth booting..");
  //lato destro
  byte i, riga=1;
  mx.setPoint(0, 3, true);
  mx.setPoint(0, 108, true);
  for(i=1 ; i<5 ; i++) mx.setPoint(riga, i, true);
  for(i=107 ; i<111 ; i++)  mx.setPoint(riga, i, true);
  riga++;
  for(i=0 ; i<7 ; i++){
    if((i>=0 && i<=1) || (i>=3 && i<=6)) mx.setPoint(riga, i, true);
  }
  for(i=105 ; i<112 ; i++){
    if((i>=105 && i<=108) || (i>=110 && i<=111)) mx.setPoint(riga, i, true);
  }
  riga++;
  for(i=0 ; i<27 ; i++){
    if((i>=0 && i<=1) || (i>=5 && i<=8) || (i>=24 && i<=26)) mx.setPoint(riga, i, true);
  }
  for(i=85 ; i<112 ; i++){
    if((i>=110 && i<=111) || (i>=103 && i<=106) || (i>=85 && i<=87)) mx.setPoint(riga, i, true);
  }
  riga++;
  for(i=0 ; i<29 ; i++){
    if((i>=0 && i<=10) || (i>=21 && i<=28)) mx.setPoint(riga, i, true);
  }
  for(i=83 ; i<112 ; i++){
    if((i>=101 && i<=111) || (i>=83 && i<=90)) mx.setPoint(riga, i, true);
  }
  riga++;
  for(i=9 ; i<31 ; i++){
    if((i>=9 && i<=12) || (i>=19 && i<=22) || (i>=27 && i<=30)) mx.setPoint(riga, i, true);
  }
  for(i=80 ; i<103 ; i++){
    if((i>=99 && i<=102) || (i>=89 && i<=92) || (i>=81 && i<=84)) mx.setPoint(riga, i, true);
  }
  riga++;
  for(i=11 ; i<32 ; i++){
    if((i>=11 && i<=14) || (i>=17 && i<=20) || (i>=29 && i<=31)) mx.setPoint(riga, i, true);
  }
  for(i=80 ; i<112 ; i++){
    if((i>=97 && i<=100) || (i>=91 && i<=94) || (i>=80 && i<=82)) mx.setPoint(riga, i, true);
  }
  riga++;
  for(i=13 ; i<32 ; i++){
    if((i>=13 && i<=18) || (i==31)) mx.setPoint(riga, i, true);
  }
  for(i=80 ; i<99 ; i++){
    if((i>=93 && i<=98) || (i==80)) mx.setPoint(riga, i, true);
  }
  PRINTS("\nnormal mouth done ");
}

void angyMouth(){
  PRINTS("\nangy  mouth booting..");
  byte i, riga=0;
  for(i=17 ; i<23 ; i++) mx.setPoint(riga, i, true);
  for(i=89 ; i<95 ; i++) mx.setPoint(riga, i, true);
  riga++;
  for(i=15 ; i<29 ; i++) mx.setPoint(riga, i, true);
  for(i=83 ; i<97 ; i++) mx.setPoint(riga, i, true);
  riga++;
  for(i=12 ; i<32 ; i++) mx.setPoint(riga, i, true);
  for(i=80 ; i<100 ; i++) mx.setPoint(riga, i, true);
  riga++;
  for(i=10 ; i<32 ; i++){
    if((i>=10 && i<=16) || (i>=21 && i<=31)) mx.setPoint(riga, i, true);
  }
  for(i=80 ; i<102 ; i++){
    if((i>=78 && i<=90) || (i>=95 && i<=101)) mx.setPoint(riga, i, true);
  }
  riga++;
  for(i=8 ; i<32 ; i++){
    if((i>=8 && i<=13) || (i>=24 && i<=31)) mx.setPoint(riga, i, true);
  }
  for(i=80 ; i<104 ; i++){
    if((i>=80 && i<=87) || (i>=98 && i<=103)) mx.setPoint(riga, i, true);
  }
  riga++;
  for(i=7 ; i<32 ; i++){
    if((i>=7 && i<=10) || (i>=27 && i<=31)) mx.setPoint(riga, i, true);
  }
  for(i=80 ; i<105 ; i++){
    if((i>=80 && i<=84) || (i>=101 && i<=104)) mx.setPoint(riga, i, true);
  }
  riga++;
  for(i=6 ; i<32 ; i++){
    if((i>=6 && i<=8) || (i>=29 && i<=31)) mx.setPoint(riga, i, true);
  }
  for(i=80 ; i<112 ; i++){
    if((i>=80 && i<=82) || (i>=103 && i<=105)) mx.setPoint(riga, i, true);
  }
  PRINTS("\nangy mouth done ");
}

void wMouth(){
  PRINTS("\nangy  mouth booting..");
  byte i, riga=0;
  mx.setPoint(riga, 3, true);
  mx.setPoint(riga, 108, true);
  riga++;
  for(i=1 ; i<29 ; i++){
    if((i>=1 && i<=4) || (i>=15 && i<=16) || (i>=27 && i<=28)) mx.setPoint(riga, i, true);
  }
  for(i=80 ; i<112 ; i++){
    if((i>=83 && i<=84) || (i>=95 && i<=96) || (i>=107 && i<=110)) mx.setPoint(riga, i, true);
  }
  riga++;
  for(i=0 ; i<30 ; i++){
    if((i>=0 && i<=1) || (i>=3 && i<=5) || (i>=14 && i<=17) || (i>=26 && i<=29)) mx.setPoint(riga, i, true);
  }
  for(i=80 ; i<112 ; i++){
    if((i>=82 && i<=85) || (i>=94 && i<=97) || (i>=106 && i<=108) || (i>=110 && i<=111)) mx.setPoint(riga, i, true);
  }
  riga++;
  for(i=0 ; i<31 ; i++){
    if((i>=0 && i<=1) || (i>=5 && i<=6) || (i>=13 && i<=14) || (i>=17 && i<=18) || (i>=25 && i<=26) || (i>=29 && i<=30)) mx.setPoint(riga, i, true);
  }
  for(i=80 ; i<112 ; i++){
    if((i>=81 && i<=82) || (i>=85 && i<=86)  || (i>=93 && i<=94) || (i>=97 && i<=98) || (i>=105 && i<=106) || (i>=110 && i<=111)) mx.setPoint(riga, i, true);
  }
  riga++;
  for(i=0 ; i<32 ; i++){
    if((i>=0 && i<=7) || (i>=12 && i<=13) || (i>=18 && i<=19) || (i>=24 && i<=25) || (i>=30 && i<=31)) mx.setPoint(riga, i, true);
  }
  for(i=80 ; i<112 ; i++){
    if((i>=80 && i<=81) || (i>=86 && i<=87)  || (i>=92 && i<=93) || (i>=98 && i<=99) || (i>=104 && i<=111)) mx.setPoint(riga, i, true);
  }
  riga++;
  for(i=0 ; i<32 ; i++){
    if((i>=7 && i<=8) || (i>=11 && i<=12) || (i>=19 && i<=20) || (i>=23 && i<=24) || i==31) mx.setPoint(riga, i, true);
  }
  for(i=80 ; i<105 ; i++){
    if(i==80 || (i>=87 && i<=88)  || (i>=91 && i<=92) || (i>=99 && i<=100) || (i>=103 && i<=104)) mx.setPoint(riga, i, true);
  }
  riga++;
  for(i=8 ; i<24 ; i++){
    if((i>=8 && i<=11) || (i>=20 && i<=23)) mx.setPoint(riga, i, true);
  }
  for(i=88 ; i<104 ; i++){
    if((i>=88 && i<=91) || (i>=100 && i<=103)) mx.setPoint(riga, i, true);
  }
  riga++;
  for(i=9 ; i<23 ; i++){
    if((i>=9 && i<=10) || (i>=21 && i<=22)) mx.setPoint(riga, i, true);
  }
  for(i=89 ; i<103 ; i++){
    if((i>=89 && i<=90) || (i>=101 && i<=102)) mx.setPoint(riga, i, true);
  }
  PRINTS("\nangy mouth done ");
}