# Check the state of button
# Print state of the button

from machine import Pin 
from time import sleep

prev_state = False
curr_state = False
counter = 0

_BTN_4 = Pin(4, Pin.IN, Pin.PULL_UP)

while True:
    prev_state = curr_state
    curr_state = not _BTN_4.value()
    if (prev_state == False and curr_state == True):
        counter += 1
    print(counter)
    sleep(0.1)