fork download
  1.  
  2. #include <Wire.h>
  3. #include <Keypad.h>
  4.  
  5. const byte rows = 4;
  6. const byte cols = 4;
  7.  
  8. char keys[rows][cols] = {
  9. {
  10. '1','2','3','A' }
  11. ,
  12. {
  13. '4','5','6','B' }
  14. ,
  15. {
  16. '7','8','9','C' }
  17. ,
  18. {
  19. '*','0','#','D' }
  20. };
  21. char dostep [4]={
  22. '0','0','0','0'};
  23. byte rowPins[rows] = {
  24. 11,10,9,8};
  25. byte colPins[cols] = {
  26. 7,6,5,4};
  27.  
  28. Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, rows, cols);
  29.  
  30. void setup()
  31. {
  32. Serial.begin(9600);
  33. }
  34. int licznik =0;
  35. void loop()
  36. {
  37. char key = keypad.getKey();
  38. if(key != NO_KEY)
  39. {
  40. Serial.print("Wcisnieto : ");
  41. Serial.print(key);
  42. Serial.print(" .\n");
  43. analogWrite(3,255);
  44. delay(100);
  45. analogWrite(3,0);
  46. if (key=='#')
  47. {
  48.  
  49. if (dostep [0]=='1' && dostep [1]=='2' && dostep [2]=='3' && dostep [3]=='4')
  50. {
  51. analogWrite(3,255); //dioda
  52. delay(500);
  53. analogWrite(3,0);
  54. analogWrite(2,255);//relay
  55. delay(5000);
  56. analogWrite(2,0);
  57. Serial.println("dostep");
  58.  
  59. }
  60. Serial.print("\n");
  61. Serial.println("RESET");
  62. licznik=0;
  63. for (int i =0; i<=3;i++)
  64. dostep[i]=0;
  65. }
  66. if (key!='#')
  67. {
  68. dostep[licznik]=key;
  69. licznik++;
  70. }
  71. Serial.print("licznik: ");
  72. Serial.println(licznik);
  73. //wypisanie zawartosci tablicy
  74. Serial.print(dostep[0]);
  75. Serial.print(" ");
  76. Serial.print(dostep[1]);
  77. Serial.print(" ");
  78. Serial.print(dostep[2]);
  79. Serial.print(" ");
  80. Serial.print(dostep[3]);
  81. Serial.print(" \n");
  82. if (licznik ==4)
  83. licznik=0;
  84.  
  85. }
  86.  
  87. }
  88.  
  89.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:2:18: fatal error: Wire.h: No such file or directory
 #include <Wire.h>
                  ^
compilation terminated.
stdout
Standard output is empty