Difference between revisions of "Radio on - off example"

From IARC 207 Wiki
Jump to navigation Jump to search
(Created page with "<pre> ' Wiring: ' SW12V -- Radio Power ''' Diagnostic Variables Public batt_volt Public Flag(8) As Boolean Public radioflag As Boolean Public commscomp...")
 
Line 51: Line 51:
  
 
</pre>
 
</pre>
 +
 +
 +
A further modification would be to make the TimeIntoInterval commands use variables for the on & off times.

Revision as of 11:50, 16 October 2015


' Wiring:
' SW12V -- Radio Power

    ''' Diagnostic Variables
    Public batt_volt
    Public Flag(8) As Boolean
    Public radioflag As Boolean  
    Public commscomplete As Boolean

BeginProg

  commscomplete = false
  radioflag=true  
  SW12 (1 )  ' turn on the radio
  Scan(30,Sec, 10, 0)
    '''''''''''''''''''''''''''''''''
    '''''''''''''''''''''''''''''''''
    '' Diagnostic Measurements  '''''
    '''''''''''''''''''''''''''''''''
    '''''''''''''''''''''''''''''''''    
    Battery(batt_volt)
    PanelTemp(Ptemp,_60Hz)
    ''''''''''''''''''''''''''''''''''''''''''''''''''''
    ''''''''''''''''''''''''''''''''''''''''''''''''''''
    '' Radio Control  ''''''''
    ''''''''''''''''''''''''''''''''''''''''''''''''''''
    ''''''''''''''''''''''''''''''''''''''''''''''''''''
      If radioflag=true Then SW12(1)
      ' if the battery voltage is high then turn the radio on hourly 
      If TimeIntoInterval(0,60,min) Then
        If batt_volt >= 12.4 Then 
          SW12(1)
        EndIf
      EndIf
      ' if the battery voltage isn't too low, turn the radio on daily.
      If TimeIntoInterval(720,1440,min) Then
        If batt_volt >= 12.2 Then 
          SW12(1)
        EndIf
      EndIf
      ' if the radioflag hasn't been set manually then turn the radio off 10 minutes into the hour.
      If TimeIntoInterval(10,60,min) OR commscomplete = true Then
        If radioflag = false Then 
          SW12(0)
          commscomplete = false
        EndIf
      EndIf      
      If batt_volt < 12.6 Then radioflag = false


A further modification would be to make the TimeIntoInterval commands use variables for the on & off times.