mikroavr

Untitled

Jul 15th, 2019
136
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <LiquidCrystal.h>
  2. LiquidCrystal lcd (2,3,4,5,6,7);
  3. int ir = A0;
  4. void setup() {
  5. lcd.begin (16,2);
  6. Serial.begin(9600);
  7. pinMode(A0,INPUT);
  8. lcd.begin(16,2); // BEGINNING THE LCD
  9. lcd.clear();
  10. lcd.setCursor(3,0);
  11. lcd.print("TEKNOLOGI");
  12. lcd.setCursor(2,1);
  13. lcd.print("ELEKTROMEDIK");                
  14. delay(2000);
  15. lcd.clear();
  16. lcd.setCursor(2,0);
  17. lcd.print("MINAL AIZIN");
  18. lcd.setCursor(2,1);
  19. lcd.print("T201601010");// SUBSCRIBE THE CHANNEL
  20. delay(2000);
  21. }
  22. int count = 0;
  23.  
  24. void loop() {
  25.   if(digitalRead(ir)==0)// CHECKING INPUT
  26.  {
  27. while(digitalRead(ir)==0)// WAITING FOR INPUT TO END
  28. {};
  29. count= count+1; // INCREMENT VISIT COUNT BY 1
  30.  
  31.  lcd.clear();
  32.  lcd.print("JUMLAH TETESAN =");
  33.  lcd.setCursor(0,2);
  34.  lcd.print(count);// DISPLAYING THE NUMBER OF VISITS.
  35.  delay(40);
  36. }
  37. else
  38. {
  39.    lcd.clear();// CASE WHEN NO INPUT IS RECEIVED.
  40.  lcd.print("JUMLAH TETESAN = ");
  41.  lcd.setCursor(0,2);
  42.  lcd.print(count);
  43.  delay(40);
  44. }
  45.  
  46. }
RAW Paste Data