Advertisement
ChaOSzz

Untitled

Apr 19th, 2022
435
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Keypad.h>
  2. #include <Servo.h>
  3. #include <LiquidCrystal.h>
  4.  
  5. int Open = 90;
  6. int Close = 0;
  7. int a = 0, b = 0, c = 0, d = 0;
  8. int var = 0;
  9.  
  10. const int C1=5, C2=6, C3=8, C4=0;
  11. char f='*';
  12.  
  13. //Клавіатура
  14. const int rows = 4;
  15. const int cols = 3;
  16.  
  17. char keys[rows][cols]=
  18. {
  19.   {'1','2','3'},
  20.   {'4','5','6'},
  21.   {'7','8','9'},
  22.   {'*','0','#'}
  23. };
  24.  
  25. byte pinrows[rows]={6,5,4,3};
  26. byte pincols[cols]={2,1,0};
  27.  
  28. Keypad keypad = Keypad(makeKeymap(keys),pinrows,pincols,rows,cols);
  29.  
  30. //Сервомотор
  31. int servostate;
  32. Servo myservo;
  33.  
  34. //РК екран
  35. LiquidCrystal lcd(8,9,10,11,12,13);
  36.  
  37. void setup()
  38. {
  39.   lcd.begin(16,2);
  40.   myservo.attach(7);
  41.   myservo.write(Close);
  42.   servostate = 0;
  43. }
  44.  
  45. void loop()
  46. {
  47.   char key = keypad.getKey();
  48.   if(key)
  49.   {
  50.     lcd.setCursor(6+var,1);
  51.     lcd.print(key);lcd.setCursor(6+var,1);delay(200);lcd.print(f);
  52.     var++;
  53.   }
  54.  
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement