Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <LiquidCrystal.h>
- #define ir A0
- LiquidCrystal lcd(8, 7, 6, 5, 4, 3);
- void setup() {
- pinMode(2,OUTPUT);
- pinMode(3,OUTPUT);
- pinMode(4,OUTPUT);
- pinMode(5,OUTPUT);
- pinMode(6,OUTPUT);
- pinMode(7,OUTPUT);
- pinMode(A0,INPUT);
- pinMode(2,OUTPUT);
- lcd.begin(16,2);
- lcd.clear();
- lcd.print(" HELLO ");
- delay(1000);
- lcd.clear();
- lcd.print("ENTER");
- lcd.setCursor(8,2);
- lcd.print("THE CUP");
- delay(1000);
- }
- int count = 0;
- void loop() {
- if(digitalRead(ir)==1)
- {
- while(digitalRead(ir)==1)
- {};
- if(count <= 10){
- count++;
- }
- else
- {
- count = 0;
- // dir hna chno bghiti yw9a3 mli twsal 10 lmarrat
- }
- lcd.clear();
- lcd.print("No. Of CUP:");
- lcd.setCursor(0,2);
- lcd.print(count);
- delay(50);
- }
- else
- {
- lcd.clear();
- lcd.print("No. Of CUP:");
- lcd.setCursor(0,2);
- lcd.print(count);
- delay(50);
- }
- /*
- // hadchi commentito latkoun baghih
- if(count==10)
- {
- lcd.clear();
- lcd.print("work:");
- digitalWrite(2,HIGH);
- delay(2000);
- digitalWrite(2,LOW);
- delay(2000);
- }
- */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement