python
from machine import Pin, ADC
import time
p15 = Pin(4, Pin.IN)
while True:
if p15.value():
print("注意:有磁性物质靠近...")
print("p15:{}".format(p15.value()))
else:
print("无磁性物质靠近...")
print("p15:{}".format(p15.value()))
time.sleep(1)