import time
from machine import Pin
from push_button import PushButton
changeCount = 0
test = {}
test["one"] = 1
led = Pin(1, Pin.OUT)
def turnLedOn():
global changeCount
changeCount += 1
print(str(changeCount) + ")turning led on")
led.on()
def turnLedOff():
print(str(changeCount) + ")turning led off")
led.off()
my_pb = PushButton(4, name="my_pb")
my_pb.onPressed(turnLedOn)
my_pb.onReleased(turnLedOff)
my_pb.printState()
print("Program is ready")
while True:
my_pb.pollState()
# if my_pb.hasButtonChanged():
# my_pb.printState()
# # if my_pb.isButtonPressed():
# # led.on()
# # else:
# # led.off()
# changeCount += 1
# print("button has changed " \
# + str(changeCount) \
# + (" time" if changeCount == 1 else " times"))