From f7ae8b4eb28931ffc5fc00f5c2175a15783f23cd Mon Sep 17 00:00:00 2001 From: topicchi Date: Sun, 26 Oct 2025 17:38:55 +0000 Subject: [PATCH] home_automated --- trunk/workspace/gcb/tiny13-Temperature.gcb | 26 +++++++++++++++------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/trunk/workspace/gcb/tiny13-Temperature.gcb b/trunk/workspace/gcb/tiny13-Temperature.gcb index 88b4d213..c1324da4 100644 --- a/trunk/workspace/gcb/tiny13-Temperature.gcb +++ b/trunk/workspace/gcb/tiny13-Temperature.gcb @@ -40,39 +40,49 @@ dir ledG out dir ledR out dir ledB out +dim t1 as byte +dim t2 as byte +dim t3 as byte +dim temp as word + 'Startup routine Startup: SET ledG OFF SET ledR OFF set ledB OFF +t1=100 +t2=100 +t3=100 'Main routine -Main: +Do 'Read temperature - 'temp=ReadAD(ADC2) - temp=ReadAD(PTH) + t1=t2 + t2=t3 + t3=ReadAD(PTH) + temp=average(t3, t2) if temp < S1 then set ledB ON SET ledG OFF SET ledR OFF end if - if (temp > S1) and (temp = S1) and (temp S2) and (temp = S2) and (temp S3 then + if temp >= S3 then set ledB OFF SET ledG OFF SET ledR ON end if - Wait 100 ms + Wait 1000 ms 'Jump back to the start of the program -goto Main +Loop