blob: 94bf08097a763de0669796a82824a3d7c69687a3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
ok = open_serial(1, 2, 115200); // port 2, baudrate 115200
if ok ~= 0 then error('Unable to open serial port, please check'); end
for i = 1:20 //Run for 20 iterations
val = cmd_analog_in(1, 4) // read analog pin 4 (thermistor)
disp(val);
if(val > 550) // Setting Threshold value of 550
cmd_digital_out(1, 3, 1) // Turn ON BUZZER
else
cmd_digital_out(1, 3, 0) // Turn OFF BUZZER
end
sleep(500);
end
cmd_digital_out(1, 3, 0) // Turn OFF BUZZER
close_serial(1);
|