#include <LiquidCrystal.h>
#define sw 8
#define pin 7
int x=0;
// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("helmy");
pinMode(sw, INPUT_PULLUP);
}
void loop() {
if(digitalRead(sw)==0){
x=x+1;
//delay(500);
if(x==10){
tone(7,68,2000);
x=0;
}
}
while(digitalRead(sw)==0){ //stop code if button pushed >> i really like that<<
}
lcd.setCursor(0,1);
lcd.print("counter:");
lcd.setCursor(9,2);
lcd.print(x);
}