Stap 4: De Code;
#include<LiquidCrystal.h>
#include<Keypad.h> #include<wire.h> const byte rows=4; const byte cols=3; char keys[rows][cols]={ {'1','2','3'}, {'4','5','6'}, {'7','8','9'}, {'*','0','#'} }; byte rowPins[rows]={13,10,9,8}; byte colPins[cols]={7,6,1}; Keypad keypad=Keypad(makeKeymap(keys),rowPins,colPins,rows,cols); LiquidCrystal Lcd(12,11,5,4,3,2); void setup() { Lcd.begin(16,2); Lcd.setCursor(1,0); Lcd.print("Press a number"); // put your setup code here, to run once: } void loop() { char key=keypad.getKey(); if(int(key)!=0) { Lcd.setCursor(5,1); Lcd.print(key); } }