import machine
import utime
# Define pin numbers
ntc_pin = machine.Pin(0) # Mock NTC pin
buzzer_pin = machine.Pin(1, machine.Pin.OUT) # GPIO pin for buzzer
# Function to simulate reading temperature from NTC sensor
def read_temperature():
# Simulate temperature value (replace with your own logic)
return 42.0 # Example temperature above 40 degrees
# Function to control the buzzer based on temperature
def control_buzzer(temperature_threshold=40):
temperature = read_temperature()
if temperature > temperature_threshold:
buzzer_pin.on()
else:
buzzer_pin.off()
# Main loop for simulation
while True:
control_buzzer() # Check temperature and control buzzer
utime.sleep(1) # Adjust the sleep duration as needed