I am trying to write a loop to read pin 14 on a pi pico. Normally the pin will be 0 (Low) but when it goes 1 (High) I would like to exit the while loop and continue with the rest of the script. I have it running and it is printing "HELLO" but when I put a high on pin 14 it doesn't "break". What I have just for this while portion is as follows:
import machine
from machine import Pin
import utime
from machine import Timer
#Create input for Pin 4
p14 = Pin(14, Pin.IN)
#Set Pin 14 Value Low Initially
#p14.value(1)
#(Section is for reading Input High on Pin 4)
check = (p14.value())
print(p14.value())
while check != 1:
check2 = (p14.value())
print("HELLO")
if check2 == 1:
print("Pin 14 went HIGH")
break
I've tried numerous iterations of while but still cannot get this to work.