from machine import pin
from time import sleep
flame_sensor=Pin(16,Pin.IN)
buzzer = Pin(17,Pin.OUT)
utime.sleep(0.5)
buzzer.high()
In1=Pin(1,Pin.OUT)
In2=Pin(0,Pin.OUT)
EN_A=PWM(Pin(2))
EN_A.freq(1500)
duty_cycle=65535
while True:
while flame sensor.value() == 1:
print("FLAME DETECTED")
buzzer.low()
In1.low()
In2.high()
EN_A.DUTY-u16(int(duty-cycle/2))
if flame-sensor.valuee() == 0:
buzzer.high()
In1.low()
In2.low()
print("NO FLAME DETECTED")
UTIME.SLEEP(0.2)