Advertisement
Guest User

Untitled

a guest
Dec 10th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. #include <LiquidCrystal.h> //Dołączenie bilbioteki
  2. LiquidCrystal lcd(2, 3, 4, 5, 6, 7); //Informacja o podłączeniu nowego wyświetlacza
  3. #define LED 8
  4. #define BUT2 10
  5. #define BUT 9
  6. int iglo = 0;
  7. int stal = 0;
  8. boolean prz=LOW;
  9. boolean prz2=LOW;
  10.  
  11. void setup() {
  12. lcd.begin(16, 2); //Deklaracja typu
  13. lcd.setCursor(1, 0); //Ustawienie kursora
  14. lcd.print("IGLOOPOL:STAL"); //Wyświetlenie tekstu
  15. lcd.setCursor(6, 1); //Ustawienie kursora
  16. // lcd.print("0:0"); //Wyświetlenie tekstu
  17. // lcd.cursor(); //Włącznie kursora
  18.  
  19. pinMode(BUT,INPUT_PULLUP);
  20. pinMode(BUT2,INPUT_PULLUP);
  21.  
  22.  
  23.  
  24. }
  25. void loop()
  26. {
  27. if(digitalRead(BUT2)==LOW)
  28. {
  29. delay(500);
  30. iglo++;
  31. }
  32. if(digitalRead(BUT)==LOW)
  33. {
  34. delay(500);
  35. stal++;
  36. }
  37. if(digitalRead(BUT)==LOW&&digitalRead(BUT2)==LOW)
  38. {
  39.  
  40. iglo=0;
  41. stal=0;
  42. delay(1000);
  43. }
  44. lcd.setCursor(8,1);
  45. lcd.print(iglo);
  46. lcd.setCursor(7,1);
  47. lcd.print(":");
  48. lcd.setCursor(6,1);
  49. lcd.print(stal);
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement