Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <LiquidCrystal.h>
- // start, stop i reset stopera
- #define Start 8
- #define Stop 9
- #define Reset 10
- LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
- int seconds = 0;
- void setup()
- {
- pinMode(Start, INPUT_PULLUP);
- pinMode(Stop, INPUT_PULLUP);
- pinMode(Reset, INPUT_PULLUP);
- lcd.begin(16,2);
- lcd.setCursor(0,0); // ustawienie kursora na poczatku pierwszej linii
- lcd.print("Press Start");
- }
- void loop()
- {
- if(digitalRead(Start)==LOW)
- {
- while(1)
- {
- seconds++; // odliczanie sekund
- delay(1000);
- lcd.clear();
- lcd.setCursor(0,0);
- lcd.print("Press Stop");
- lcd.setCursor(0,1);
- lcd.print(seconds);
- }
- }
- if(digitalRead(Stop)==LOW) // zastopowanie licznika i pokazane sekundy
- {
- lcd.clear();
- lcd.setCursor(0,0);
- lcd.print("Seconds :");
- lcd.setCursor(10,0);
- lcd.print(seconds);
- lcd.setCursor(0,1);
- lcd.print("Press Reset");
- }
- if(digitalRead(Reset)==LOW) // restart licznika
- {
- lcd.clear();
- seconds = 0;
- lcd.print("Press Start");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement