CONSIGLI E AIUTO PER REALIZZAZIONE COMPARATORE

Oggi, all'ora di pranzo mi sono divertito a vedere cosa si può fare, intanto ho buttato giù un progettino per la versione "remote" ( quella dei 10 pezzi ).
Che poi uno può scegliere se farla cablata o wireless .

Questo è lo schema

e questo è cosa viene fuori

eE c'è anche un abbozzo di sketch, a cui manca ancora la parte di trasmissione

#include <Keypad.h>
#include <Led7Segment.h>  // https://github.com/janezd/Led7Segment
Led7Segment display(11, 10); // CLK, DIO

char keyInsert[4];
int val = 0;
byte j = 0;

const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
  {'1', '2', '3'},
  {'4', '5', '6'},
  {'7', '8', '9'},
  {'*', '0', '#'}
};
byte rowPins[ROWS] = {8, 3, 4, 6}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {7, 9, 5}; //connect to the column pinouts of the keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup() {
  Serial.begin(9600);
  display.setBrightness(0);  // set the brightness da 0 a 7
  // delay(1000);                
  display.clearDisplay();
  display.showNumber(0);
}

void loop() {
  char key = keypad.getKey();

  if (key != NO_KEY && j < 4 && key != '*') {
     display.setBrightness(7); // aumenta luminosita'
    keyInsert[j] = key;
    val = atoi(keyInsert );
    display.showNumber(val);
    j++;
  }
  if (key == '#') {
    for ( int a = 0; a < 4; a++ ) {
      keyInsert[a] = '\0';
    }
    j = 0 ;
    display.clearDisplay();
    punti();
     display.setBrightness(0); 
    display.showNumber(0);
  }

  if (key == '*') {
    //  Serial.print (val);
    for ( int a = 0; a < 6; a++ ) {
      display.turnOff();
      delay(100);
      display.turnOn();
      delay(100);
    }
  }
} // Fine Loop

   // Blink the dot(s) in the middle (e.g. like a clock)
void punti()  {
  for(int i = 0; i < 5; i++) {
        display.setDots(4);
        delay(100);
        display.setDots(0);
        delay(100);
    }
}