Bear Code test #25

The bear

Senior Member
Rich (BB code):
  ;IRRIGATION using Buzby timer v1.0a 12.06.19
  #picaxe 08m2 ;274 Bytes Toggle C.1 = 12v present
  #No_data    ;1 HR delay, ON for 1 Hr, OFF for 2 Hrs, ON  for 1 HR
  #Com 3   ;Resets after 24 Hrs
     
  Sertxd("IRRIGATION using Buzby timer v1.0a 12.06.19",13,10)
  Symbol minutes = w2
  Symbol hours   = w3
  Symbol valve  = C.2 'was C.4
  Symbol valvesupplyled = C.1
  Symbol valvepower = pinC.3
  ' Start of code
  minutes  = 0
  hours  = 0
  Do
   Do ' Hours loop
    time = 0  ' Reset in-built seconds counter
    Do ' Minutes loop
  ;----------------------------------------------------
  If valvepower = 0 Then '+12v present
    Toggle valvesupplyled 'Flash Led
  Endif
  ;------------------------------------------------
    Pause 1000
  ;Sertxd (#hours,":",#minutes,":",#time,Cr,Lf)  'Com'd out when in use.    
    Loop Until time > 59 ' *** Should be 59 for one minute
    minutes = minutes + 1
  Loop Until minutes > 59 ' *** Should be 59 for one hour
    hours = hours + 1
    minutes = 0
  If hours = 1 Then
    Sertxd ("Valve operated ON",Cr,Lf)
    High valve  ' Operate Valve ON for 1 Hour
  Endif
  If hours = 2  Then  ;was 24
    Sertxd ("Valve operated OFF",Cr,Lf)
    Low valve 'Valve OFF
  Endif 
  If hours = 4  Then  ;was 24
    Sertxd ("Valve operated ON",Cr,Lf)
    High valve 'Valve OFF
  Endif
  If hours = 5  Then  ;was 24
    Sertxd ("Valve operated OFF",Cr,Lf)
    Low valve 'Valve OFF
  Endif
  If hours = 24  Then  ;was 24
   
  Reset 'Every 24 Hours
   Endif
  Loop
 
Top