#Region Project Attributes
#AutoFlushLogs: True
#CheckArrayBounds: True
#StackBufferSize: 600
#End Region
'Ctrl+Click to open the C code folder: ide://run?File=%WINDIR%\System32\explorer.exe&Args=%PROJECT%\Objects\Src
Sub Process_Globals
Public Serial1 As Serial
Public ADC1 As Pin ' Pin de la Entrada Analogica 1
Public ADC2 As Pin ' Pin de la Entrada Analogica 2
Public DAC1 As Pin
Public DAC2 As Pin
Public V_DAC As Byte
Public T_C As Timer
End Sub
Private Sub AppStart
Serial1.Initialize(9600)
Log("AppStart")
' Configura Entradas Analogicas
'ADC1.Initialize(36,ADC1.MODE_INPUT)
ADC1.Initialize(ADC1.A0, ADC1.MODE_INPUT) ' for GPIO36
'ADC2.Initialize(39,ADC2.MODE_INPUT)
ADC2.Initialize(ADC2.A3, ADC2.MODE_INPUT) ' for GPIO39
DAC1.Initialize(25,DAC1.MODE_OUTPUT)
DAC2.Initialize(26,DAC2.MODE_OUTPUT)
' Lanza Tarea
T_C.Initialize("T_C_Tick",500)
T_C.Enabled = True
End Sub
Private Sub T_C_Tick
Dim Dl1 As UInt
Dim DL2 As UInt
DAC1.AnalogWrite(V_DAC)
DAC1.AnalogWrite(255-V_DAC)
V_DAC = V_DAC + 1
If V_DAC > 255 Then V_DAC = 0
' Lee Entradas
Dl1 = ADC1.AnalogRead
DL2 = ADC1.AnalogRead
' Presenta Resultados
Log("Dl1= ", NumberFormat(Dl1,4,0)," ... Dl2= ", NumberFormat(DL2,4,0)," ... V_DAC= ", NumberFormat(V_DAC,3,0))
End Sub