Advertisement
mhdew

ES_project

Dec 16th, 2020
831
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.63 KB | None | 0 0
  1. #include<LiquidCrystal.h>
  2.  
  3. LiquidCrystal lcd(13,12,11,10,9,8);
  4.  
  5. char c[10];
  6. int idx=0,i,ct=0;
  7.  
  8. void setup()
  9. {
  10.   pinMode(2, OUTPUT);
  11.   pinMode(3, INPUT);
  12.   pinMode(4, INPUT);
  13.   pinMode(5, INPUT);
  14.   pinMode(6, INPUT);
  15.   pinMode(7, INPUT);
  16.  
  17.   lcd.begin(16,2);
  18.   for(i=0;i<9;i++){ c[i]=' '; }
  19.   ct=0;
  20. }
  21.  
  22. void loop()
  23. {
  24.   if(digitalRead(3)==HIGH){
  25.     digitalWrite(2,HIGH);
  26.     c[idx++]='.';
  27.     ct++;
  28.   }
  29.   else if(digitalRead(4)==HIGH){
  30.     digitalWrite(2,HIGH);
  31.     c[idx++]='-';
  32.     ct++;
  33.   }
  34.   else if(digitalRead(5)==HIGH){
  35.     digitalWrite(2,HIGH);
  36.     lcd.print(ct);
  37.     lcd.print(c);
  38.     while(1){}
  39.   }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement