from machine import Pin
import time
# PIR motion sensor
pir = Pin(16, Pin.IN)
# Alert devices
led = Pin(15, Pin.OUT)
buzzer = Pin(14, Pin.OUT)
print("Smart Exam Cheating Detector Started")
while True:
motion = pir.value()
if motion == 1:
print("⚠️ Suspicious Movement Detected!")
led.on()
buzzer.on()
time.sleep(1)
else:
print("Normal Behavior")
led.off()
buzzer.off()
time.sleep(0.5)