//q1
//q2
void setup()
{
Serial.begin(9600);
init_clavier();
}
void init_clavier()
{
DDRD |= B11100;
DDRB &= ~B1111;
PORTB |= B1111;
}
bool etat_touche_1()
{
PORTD |= B11100;
PORTD &= ~(1<<4);
return not ( PINB & (1<<3) );
}
/*
const byte ROWS = 4; //4 colonnes
const byte COLS = 3; //3 colonnes
const byte rowPins[ROWS] = {11,10,9,8};//entrées PORTB
const byte colPins[COLS] = {4,3,2}; //sorties PORTDă
const char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'*','0','#'}
};
void setup() {
Serial.begin(9600);
}*/
void loop() {
if (etat_touche_1())
Serial.print("Le 1 est pressé \n");
}