sorry, i think i forgot the attachments
Help with data on serial port
The English language is difficult for me, that's why I use google translate.
Sorry for the mistakes. I don't even know if I'm in the right forum here.
Arduino programming works fine, but I really don't understand vb very much.
Can someone help me with the following:
For several years I have been using a visual studio program to control my aquarium.
That worked perfectly until I connected new meters for measuring temperature,
acidity and conductivity of the water.
An Arduino mega displays the read values on the serial monitor.
The EC value should appear in TextBox3.Text
The TEMP value should appear in tb_temperature.Text
The PH value should appear in tb_pH.Text
The BV value should appear in TextBox4.Text
From there they can then be further processed to control the outputs of the Arduino mega board.
So the difficulty lies in sizing and writing the input data of the serial port.
Enclosed are a few images of what arrives on the serial port, the vb program and a
screenshot of the result I sometimes get on the screen.
Also a picture of the error code: "the index is outside the matrix bounds".
Do any of you want to modify the vb class so that my "Aquarium Controller" works again ???
I would be very grateful if I could get everything working again.
Sincerely,
Stan
The program:
Imports System.IO
Imports System.Windows.Markup
Public Class VISBAK
Dim inputData As String = ""
Dim flasch As Boolean = True
Public P_Klok830l_Aan_Uit As Boolean
Public P_Klok830r_Aan_Uit As Boolean
Public P_Klok840l_Aan_Uit As Boolean
Public P_Klok840r_Aan_Uit As Boolean
Public P_Klok865l_Aan_Uit As Boolean
Public P_Klok865r_Aan_Uit As Boolean
Public P_Kloknacht_Aan_Uit As Boolean
Public P_KlokledspotLinks_Aan_Uit As Boolean
Public P_KlokledspotRechts_Aan_Uit As Boolean
Public P_ProcVerwarming_Aan_Uit As Boolean
Public P_ProcKoeling_Aan_Uit As Boolean
Public P_ProcBijvullen_Aan_Uit As Boolean
Public P_ProcCO2Dosering_Aan_Uit As Boolean
Public P_KlokReactor_Aan_Uit As Boolean
Public P_KlokCirculatie_Aan_Uit As Boolean
Public P_FolderNames() As String
Public P_AanUit_Tijden(28) As String
Public Event DataReceived As IO.Ports.SerialDataReceivedEventHandler
Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
SerialPort1.PortName = "COM3"
SerialPort1.BaudRate = 9600
SerialPort1.Parity = IO.Ports.Parity.None
SerialPort1.DataBits = 8
SerialPort1.StopBits = IO.Ports.StopBits.One
SerialPort1.Handshake = IO.Ports.Handshake.None
SerialPort1.RtsEnable = True
If Not SerialPort1.IsOpen Then
SerialPort1.Open()
End If
P_Klok830l_Aan_Uit = True
P_Klok830r_Aan_Uit = True
P_Klok840l_Aan_Uit = True
P_Klok840r_Aan_Uit = True
P_Klok865l_Aan_Uit = True
P_Klok865r_Aan_Uit = True
P_Kloknacht_Aan_Uit = True
P_ProcVerwarming_Aan_Uit = True
P_ProcKoeling_Aan_Uit = False
P_ProcBijvullen_Aan_Uit = True
P_ProcCO2Dosering_Aan_Uit = True
P_KlokReactor_Aan_Uit = True
P_KlokCirculatie_Aan_Uit = True
P_KlokledspotLinks_Aan_Uit = True
P_KlokledspotRechts_Aan_Uit = True
'Read the 28 On & Off times
F_ReadAMSFolders()
End Sub
Private Sub SerialPort1_DataReceived(ByVal sender As System.Object,
ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) _
Handles SerialPort1.DataReceived
Dim inputData = SerialPort1.ReadLine
Me.Invoke(New Action(Of String)(AddressOf DoUpdate), inputData)
End Sub
Private Sub DoUpdate(inputData As String)
Dim values() As String = inputData.Split(":")
TextBox3.Text = values(1) 'Geleidbaarheid
tb_temperatuur.Text = values(2) 'Temperatuur
tb_pH.Text = values(3) 'Zuurgraad
TextBox4.Text = values(4) 'Bijvullen
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Actueletijd.Text = DateTime.Now.ToLongTimeString
If P_ProcBijvullen_Aan_Uit = True Then
If TextBox4.Text = "1" Then
SerialPort1.Write("Q")
tb_bijvullen.BackColor = Color.Aqua
TextBox4.BackColor = Color.LightBlue
tb_OL5.BackColor = Color.Red
Else
'TextBox4.Text = "0"
SerialPort1.Write("q")
tb_bijvullen.BackColor = Color.LightGreen
TextBox4.BackColor = Color.LightGreen
tb_OL5.BackColor = Color.LightGreen
End If
End If
If P_ProcVerwarming_Aan_Uit = True Then
If tb_temperatuur.Text <= P_AanUit_Tijden(15) And tb_temperatuur.Text <= P_AanUit_Tijden(16) Then
SerialPort1.Write("L")
tb_verwarming.BackColor = Color.Aqua
tb_OL1.BackColor = Color.Red
Else
SerialPort1.Write("l")
tb_verwarming.BackColor = Color.LightGreen
tb_OL1.BackColor = Color.LightGreen
End If
End If
If P_ProcKoeling_Aan_Uit = True Then
If tb_temperatuur.Text >= P_AanUit_Tijden(17) And tb_temperatuur.Text <= P_AanUit_Tijden(18) Then
SerialPort1.Write("M")
tb_koeling.BackColor = Color.Aqua
tb_OL3.BackColor = Color.Red
Else
SerialPort1.Write("m")
tb_koeling.BackColor = Color.LightGreen
tb_OL3.BackColor = Color.LightGreen
End If
End If
If P_ProcCO2Dosering_Aan_Uit = True Then
If tb_pH.Text >= P_AanUit_Tijden(19) And tb_pH.Text >= P_AanUit_Tijden(20) And
DateTime.Now.ToLongTimeString >= P_AanUit_Tijden(21) Then 'And DateTime.Now.ToLongTimeString <= P_AanUit_Tijden(22) Then
SerialPort1.Write("R")
tb_co2_dosering.BackColor = Color.Aqua
tb_B1.BackColor = Color.Red
Else
SerialPort1.Write("r")
tb_co2_dosering.BackColor = Color.LightGreen
tb_B1.BackColor = Color.LightGreen
End If
End If
If P_Klok830l_Aan_Uit = True Then
If DateTime.Now.ToLongTimeString >= P_AanUit_Tijden(1) And DateTime.Now.ToLongTimeString <= P_AanUit_Tijden(2) Then
SerialPort1.Write("A")
btn_klok_830_links.BackColor = Color.Yellow
tb_tl_5_voor.BackColor = Color.Yellow
tb_B3.BackColor = Color.Red
Else
SerialPort1.Write("a")
tb_tl_5_voor.BackColor = Color.LightBlue
btn_klok_830_links.BackColor = Color.Yellow
tb_B3.BackColor = Color.LightGreen
End If
End If
If P_Klok830r_Aan_Uit = True Then
If DateTime.Now.ToLongTimeString >= P_AanUit_Tijden(3) And DateTime.Now.ToLongTimeString <= P_AanUit_Tijden(4) Then
SerialPort1.Write("B")
btn_klok_830_rechts.BackColor = Color.Yellow
tb_830_rechts.BackColor = Color.Yellow
tb_B7.BackColor = Color.Red
Else
SerialPort1.Write("b")
tb_830_rechts.BackColor = Color.LightBlue
btn_klok_830_rechts.BackColor = Color.Yellow
tb_B7.BackColor = Color.LightGreen
End If
End If
If P_Klok840l_Aan_Uit = True Then
If DateTime.Now.ToLongTimeString >= P_AanUit_Tijden(5) And DateTime.Now.ToLongTimeString <= P_AanUit_Tijden(6) Then
SerialPort1.Write("C")
btn_klok_840_links.BackColor = Color.Yellow
tb_840_links.BackColor = Color.Yellow
tb_B4.BackColor = Color.Red
Else
SerialPort1.Write("c")
tb_840_links.BackColor = Color.LightBlue
btn_klok_840_links.BackColor = Color.Yellow
tb_B4.BackColor = Color.LightGreen
End If
End If
If P_Klok840r_Aan_Uit = True Then
If DateTime.Now.ToLongTimeString >= P_AanUit_Tijden(7) And DateTime.Now.ToLongTimeString <= P_AanUit_Tijden(8) Then
SerialPort1.Write("D")
btn_klok_840_rechts.BackColor = Color.Yellow
tb_840_rechts.BackColor = Color.Yellow
tb_B8.BackColor = Color.Red
Else
SerialPort1.Write("d")
tb_840_rechts.BackColor = Color.LightBlue
btn_klok_840_rechts.BackColor = Color.Yellow
tb_B8.BackColor = Color.LightGreen
End If
End If
If P_Klok865l_Aan_Uit = True Then
If DateTime.Now.ToLongTimeString >= P_AanUit_Tijden(9) And DateTime.Now.ToLongTimeString <= P_AanUit_Tijden(10) Then
SerialPort1.Write("E")
btn_klok_865_links.BackColor = Color.Yellow
tb_865_links.BackColor = Color.Yellow
tb_B5.BackColor = Color.Red
Else
SerialPort1.Write("e")
tb_865_links.BackColor = Color.LightBlue
btn_klok_865_links.BackColor = Color.Yellow
tb_B5.BackColor = Color.LightGreen
End If
End If
If P_Klok865r_Aan_Uit = True Then
If DateTime.Now.ToLongTimeString >= P_AanUit_Tijden(11) And DateTime.Now.ToLongTimeString <= P_AanUit_Tijden(12) Then
SerialPort1.Write("F")
btn_klok_865_rechts.BackColor = Color.Yellow
tb_865_rechts.BackColor = Color.Yellow
tb_B9.BackColor = Color.Red
Else
SerialPort1.Write("f")
tb_865_rechts.BackColor = Color.LightBlue
btn_klok_865_rechts.BackColor = Color.Yellow
tb_B9.BackColor = Color.LightGreen
End If
End If
If P_Kloknacht_Aan_Uit = True Then
If DateTime.Now.ToLongTimeString <= P_AanUit_Tijden(13) And DateTime.Now.ToLongTimeString >= P_AanUit_Tijden(14) Then
SerialPort1.Write("g")
btn_klok_nachtverlichting.BackColor = Color.Yellow
tb_nachtverlichting.BackColor = Color.LightBlue
tb_B6.BackColor = Color.LightGreen
Else
SerialPort1.Write("G")
tb_nachtverlichting.BackColor = Color.Yellow
btn_klok_nachtverlichting.BackColor = Color.Yellow
tb_B6.BackColor = Color.Red
End If
End If
If P_KlokReactor_Aan_Uit = True Then
If DateTime.Now.ToLongTimeString >= P_AanUit_Tijden(21) And DateTime.Now.ToLongTimeString <= P_AanUit_Tijden(22) Then
SerialPort1.Write("U")
btn_klok_reactor.BackColor = Color.Yellow
tb_co2_reactor.BackColor = Color.Yellow
tb_OL6.BackColor = Color.Red
Else
SerialPort1.Write("u")
tb_co2_reactor.BackColor = Color.LightBlue
btn_klok_reactor.BackColor = Color.Yellow
tb_OL6.BackColor = Color.LightGreen
End If
End If
If P_KlokCirculatie_Aan_Uit = True Then
P_KlokCirculatie_Aan_Uit = True
tb_L2.BackColor = Color.LightGreen
If DateTime.Now.ToLongTimeString >= P_AanUit_Tijden(23) And DateTime.Now.ToLongTimeString <= P_AanUit_Tijden(24) Then
SerialPort1.Write("Z")
btn_klok_circulatie.BackColor = Color.Yellow
tb_circulatie.BackColor = Color.Yellow
tb_L2.BackColor = Color.Red
Else
SerialPort1.Write("z")
tb_circulatie.BackColor = Color.LightBlue
btn_klok_circulatie.BackColor = Color.Yellow
tb_L2.BackColor = Color.LightGreen
End If
End If
If P_KlokledspotLinks_Aan_Uit = True Then
If DateTime.Now.ToLongTimeString >= P_AanUit_Tijden(25) And DateTime.Now.ToLongTimeString <= P_AanUit_Tijden(26) Then
SerialPort1.Write("V")
btn_klok_ledspot_links.BackColor = Color.Yellow
tb_ledspot_links.BackColor = Color.Yellow
tb_O2.BackColor = Color.Red
Else
SerialPort1.Write("v")
tb_ledspot_links.BackColor = Color.LightBlue
btn_klok_ledspot_links.BackColor = Color.Yellow
tb_O2.BackColor = Color.LightGreen
End If
End If
If P_KlokledspotRechts_Aan_Uit = True Then
If DateTime.Now.ToLongTimeString >= P_AanUit_Tijden(27) And DateTime.Now.ToLongTimeString <= P_AanUit_Tijden(28) Then
SerialPort1.Write("W")
btn_klok_ledspot_rechts.BackColor = Color.Yellow
tb_ledspot_rechts.BackColor = Color.Yellow
tb_R5.BackColor = Color.Red
Else
SerialPort1.Write("w")
tb_ledspot_rechts.BackColor = Color.LightBlue
btn_klok_ledspot_rechts.BackColor = Color.Yellow
tb_R5.BackColor = Color.LightGreen
End If
End If
End Sub
Private Sub btn_klok_830_links_Click(sender As Object, e As EventArgs) Handles btn_klok_830_links.Click
If P_Klok830l_Aan_Uit = False Then
P_Klok830l_Aan_Uit = True
btn_klok_830_links.BackColor = Color.Yellow
Else
P_Klok830l_Aan_Uit = False
btn_klok_830_links.BackColor = Color.Lime
tb_tl_5_voor.BackColor = Color.Lime
End If
End Sub
Private Sub btn_klok_830_rechts_Click(sender As Object, e As EventArgs) Handles btn_klok_830_rechts.Click
If P_Klok830r_Aan_Uit = False Then
P_Klok830r_Aan_Uit = True
btn_klok_830_rechts.BackColor = Color.Yellow
Else
P_Klok830r_Aan_Uit = False
btn_klok_830_rechts.BackColor = Color.Lime
tb_830_rechts.BackColor = Color.Lime
End If
End Sub
Private Sub btn_klok_840_links_Click(sender As Object, e As EventArgs) Handles btn_klok_840_links.Click
If P_Klok840l_Aan_Uit = False Then
P_Klok840l_Aan_Uit = True
btn_klok_840_links.BackColor = Color.Yellow
Else
P_Klok840l_Aan_Uit = False
btn_klok_840_links.BackColor = Color.Lime
tb_840_links.BackColor = Color.Lime
End If
End Sub
Private Sub btn_klok_840_rechts_Click(sender As Object, e As EventArgs) Handles btn_klok_840_rechts.Click
If P_Klok840r_Aan_Uit = False Then
P_Klok840r_Aan_Uit = True
btn_klok_840_rechts.BackColor = Color.Yellow
Else
P_Klok840r_Aan_Uit = False
btn_klok_840_rechts.BackColor = Color.Lime
tb_840_rechts.BackColor = Color.Lime
End If
End Sub
Private Sub btn_klok_865_links_Click(sender As Object, e As EventArgs) Handles btn_klok_865_links.Click
If P_Klok865l_Aan_Uit = False Then
P_Klok865l_Aan_Uit = True
btn_klok_865_links.BackColor = Color.Yellow
Else
P_Klok865l_Aan_Uit = False
btn_klok_865_links.BackColor = Color.Lime
tb_865_links.BackColor = Color.Lime
End If
End Sub
Private Sub btn_klok_865_rechts_Click(sender As Object, e As EventArgs) Handles btn_klok_865_rechts.Click
If P_Klok865r_Aan_Uit = False Then
P_Klok865r_Aan_Uit = True
btn_klok_865_rechts.BackColor = Color.Yellow
Else
P_Klok865r_Aan_Uit = False
btn_klok_865_rechts.BackColor = Color.Lime
tb_865_rechts.BackColor = Color.Lime
End If
End Sub
Private Sub btn_klok_nachtverlichting_Click(sender As Object, e As EventArgs) Handles btn_klok_nachtverlichting.Click
If P_Kloknacht_Aan_Uit = False Then
P_Kloknacht_Aan_Uit = True
btn_klok_nachtverlichting.BackColor = Color.Yellow
Else
P_Kloknacht_Aan_Uit = False
btn_klok_nachtverlichting.BackColor = Color.Lime
tb_nachtverlichting.BackColor = Color.Lime
End If
End Sub
Private Sub btn_klok_ledspot_links_Click(sender As Object, e As EventArgs) Handles btn_klok_ledspot_links.Click
If P_KlokledspotLinks_Aan_Uit = False Then
P_KlokledspotLinks_Aan_Uit = True
btn_klok_ledspot_links.BackColor = Color.Yellow
Else
P_KlokledspotLinks_Aan_Uit = False
btn_klok_ledspot_links.BackColor = Color.Lime
tb_ledspot_links.BackColor = Color.Lime
End If
End Sub
Function F_MyDocuments_Path() As String
Dim objFSO As Object
Dim objShell As Object
Dim objFolder As Object
Dim objFolderItem As Object
Const MY_DOCUMENTS = &H5&
objFSO = CreateObject("Scripting.FileSystemObject")
objShell = CreateObject("Shell.Application")
objFolder = objShell.Namespace(MY_DOCUMENTS)
objFolderItem = objFolder.Self
F_MyDocuments_Path = objFolderItem.Path
End Function
Private Sub F_ReadAMSFolders()
Try
' Check if folder "Stan_Tijden" exists
Dim dirs As String() = Directory.GetDirectories(F_MyDocuments_Path() & "\Stan_Tijden")
F_ReadLogFiles("Stan_Tijden")
' if folder "Stan_Tijden" not exists, create folder "Stan_Tijden"
Catch e As Exception
Dim filePath As String
filePath = System.IO.Path.Combine(
My.Computer.FileSystem.SpecialDirectories.MyDocuments, "Stan_Tijden\")
My.Computer.FileSystem.CreateDirectory(filePath)
' Create default .TXT log file in folder "Stan_Tijden" with 28 on off times with 0:00:00 values
F_SaveOnOffTimes()
End Try
End Sub
Private Sub F_SaveOnOffTimes()
'Save the On & Off Times
Dim filePath As String
filePath = System.IO.Path.Combine(
My.Computer.FileSystem.SpecialDirectories.MyDocuments, "Stan_Tijden\")
My.Computer.FileSystem.CreateDirectory(filePath)
' Create .TXT log file in folder "Stan_Tijden"
F_WriteLogFiles("Stan_Tijden\")
'Read the 28 On & Off times
F_ReadAMSFolders()
End Sub
Private Sub F_WriteLogFiles(FolderName As String)
Dim Y As Integer
Try
Dim filePath As String
filePath = System.IO.Path.Combine(
My.Computer.FileSystem.SpecialDirectories.MyDocuments, FolderName, "Stan_Tijden" & ".txt")
If My.Computer.FileSystem.FileExists(filePath) Then
FileOpen(168, filePath, OpenMode.Output)
For Y = 1 To 28
PrintLine(168, "00:00:00")
Next
FileClose(168)
Else
System.IO.File.Create(filePath).Dispose()
FileOpen(168, filePath, OpenMode.Output)
For Y = 1 To 28
PrintLine(168, "00:00:00")
Next
FileClose(168)
End If
Catch fileException As Exception
Throw fileException
End Try
End Sub
Function F_ReadLogFiles(FolderName As String) As Boolean
Dim LogLineAmount As Integer
Try
Dim filePath As String
filePath = System.IO.Path.Combine(
My.Computer.FileSystem.SpecialDirectories.MyDocuments, FolderName, "Stan_Tijden" & ".txt")
If My.Computer.FileSystem.FileExists(filePath) Then
FileOpen(168, filePath, OpenMode.Input)
LogLineAmount = 0
While Not EOF(168)
LogLineAmount = LogLineAmount + 1
P_AanUit_Tijden(LogLineAmount) = LineInput(168)
End While
FileClose(168)
F_ReadLogFiles = True
Else
My.Computer.FileSystem.WriteAllText(filePath, "", True)
End If
Catch fileException As Exception
MsgBox("Save new reefsystem " & FolderName & " first")
FileClose(168)
F_ReadLogFiles = False
Exit Function
End Try
End Function
Private Sub Update_btn_Click(sender As Object, e As EventArgs) Handles Update_btn.Click
'Read the 28 On & Off times
F_ReadAMSFolders()
End Sub
Private Sub aan_btn_bijvullen_Click(sender As Object, e As EventArgs) Handles aan_btn_bijvullen.Click
SerialPort1.Write("Q")
tb_bijvullen.BackColor = Color.LightCoral
tb_OL5.BackColor = Color.Red
End Sub
Private Sub uit_btn_bijvullen_Click(sender As Object, e As EventArgs) Handles uit_btn_bijvullen.Click
SerialPort1.Write("q")
tb_bijvullen.BackColor = Color.LightGreen
tb_OL5.BackColor = Color.LightGreen
End Sub
Private Sub aan_btn_830_links_Click(sender As Object, e As EventArgs) Handles aan_btn_TL_5_VOOR.Click
SerialPort1.Write("A")
tb_tl_5_voor.BackColor = Color.LightCoral
tb_B3.BackColor = Color.Red
End Sub
Private Sub uit_btn_830_links_Click(sender As Object, e As EventArgs) Handles uit_btn_TL_5_VOOR.Click
SerialPort1.Write("a")
tb_tl_5_voor.BackColor = Color.LightGreen
tb_B3.BackColor = Color.LightGreen
End Sub
Private Sub aan_btn_830_rechts_Click(sender As Object, e As EventArgs) Handles aan_btn_830_rechts.Click
SerialPort1.Write("B")
tb_830_rechts.BackColor = Color.LightCoral
tb_B7.BackColor = Color.Red
End Sub
Private Sub aan_btn_840_links_Click(sender As Object, e As EventArgs) Handles aan_btn_840_links.Click
SerialPort1.Write("C")
tb_840_links.BackColor = Color.LightCoral
tb_B4.BackColor = Color.Red
End Sub
Private Sub aan_btn_840_rechts_Click(sender As Object, e As EventArgs) Handles aan_btn_840_rechts.Click
SerialPort1.Write("D")
tb_840_rechts.BackColor = Color.LightCoral
tb_B8.BackColor = Color.Red
End Sub
Private Sub aan_btn_865_links_Click(sender As Object, e As EventArgs) Handles aan_btn_865_links.Click
SerialPort1.Write("E")
tb_865_links.BackColor = Color.LightCoral
tb_B5.BackColor = Color.Red
End Sub
Private Sub aan_btn_865_rechts_Click(sender As Object, e As EventArgs) Handles aan_btn_865_rechts.Click
SerialPort1.Write("F")
tb_865_rechts.BackColor = Color.LightCoral
tb_B9.BackColor = Color.Red
End Sub
Private Sub aan_bt_nachtverlichting_Click(sender As Object, e As EventArgs) Handles aan_bt_nachtverlichting.Click
SerialPort1.Write("G")
tb_nachtverlichting.BackColor = Color.LightCoral
tb_B6.BackColor = Color.Red
End Sub
Private Sub aan_bt_uv_lamp_Click(sender As Object, e As EventArgs) Handles aan_bt_uv_lamp.Click
SerialPort1.Write("H")
tb_uv_lamp.BackColor = Color.LightCoral
tb_OR1.BackColor = Color.Red
End Sub
Private Sub aan_bt_licht_onder_Click(sender As Object, e As EventArgs) Handles aan_bt_licht_onder.Click
SerialPort1.Write("I")
tb_licht_onder.BackColor = Color.LightCoral
tb_OR4.BackColor = Color.Red
End Sub
Private Sub aan_bt_filter_links_Click(sender As Object, e As EventArgs) Handles aan_bt_filter_links.Click
SerialPort1.Write("J")
tb_filter_links.BackColor = Color.LightCoral
tb_O1.BackColor = Color.Red
End Sub
Private Sub aan_bt_filter_rechts_Click(sender As Object, e As EventArgs) Handles aan_bt_filter_rechts.Click
SerialPort1.Write("K")
tb_filter_rechts.BackColor = Color.LightCoral
tb_O3.BackColor = Color.Red
End Sub
Private Sub aan_bt_verwarming_Click(sender As Object, e As EventArgs) Handles aan_bt_verwarming.Click
SerialPort1.Write("L")
tb_verwarming.BackColor = Color.LightCoral
tb_OL1.BackColor = Color.Red
End Sub
Private Sub aan_bt_koeling_Click(sender As Object, e As EventArgs) Handles aan_bt_koeling.Click
SerialPort1.Write("M")
tb_koeling.BackColor = Color.LightCoral
tb_OL3.BackColor = Color.Red
End Sub
Private Sub uit_btn_830_rechts_Click(sender As Object, e As EventArgs) Handles uit_btn_830_rechts.Click
SerialPort1.Write("b")
tb_830_rechts.BackColor = Color.LightGreen
tb_B7.BackColor = Color.LightGreen
End Sub
Private Sub uit_btn_840_links_Click(sender As Object, e As EventArgs) Handles uit_btn_840_links.Click
SerialPort1.Write("c")
tb_840_links.BackColor = Color.LightGreen
tb_B4.BackColor = Color.LightGreen
End Sub
Private Sub uit_btn_840_rechts_Click(sender As Object, e As EventArgs) Handles uit_btn_840_rechts.Click
SerialPort1.Write("d")
tb_840_rechts.BackColor = Color.LightGreen
tb_B8.BackColor = Color.LightGreen
End Sub
Private Sub uit_btn_865_links_Click(sender As Object, e As EventArgs) Handles uit_btn_865_links.Click
SerialPort1.Write("e")
tb_865_links.BackColor = Color.LightGreen
tb_B5.BackColor = Color.LightGreen
End Sub
Private Sub uit_btn_865_rechts_Click(sender As Object, e As EventArgs) Handles uit_btn_865_rechts.Click
SerialPort1.Write("f")
tb_865_rechts.BackColor = Color.LightGreen
tb_B9.BackColor = Color.LightGreen
End Sub
Private Sub uit_btn_nachtverlichting_Click(sender As Object, e As EventArgs) Handles uit_btn_nachtverlichting.Click
SerialPort1.Write("g")
tb_nachtverlichting.BackColor = Color.LightGreen
tb_B6.BackColor = Color.LightGreen
End Sub
Private Sub uit_btn_uv_lamp_Click(sender As Object, e As EventArgs) Handles uit_btn_uv_lamp.Click
SerialPort1.Write("h")
tb_uv_lamp.BackColor = Color.LightGreen
tb_OR1.BackColor = Color.LightGreen
End Sub
Private Sub uit_btn_licht_onder_Click(sender As Object, e As EventArgs) Handles uit_btn_licht_onder.Click
SerialPort1.Write("i")
tb_licht_onder.BackColor = Color.LightGreen
tb_OR4.BackColor = Color.LightGreen
End Sub
Private Sub uit_btn_filter_links_Click(sender As Object, e As EventArgs) Handles uit_btn_filter_links.Click
SerialPort1.Write("j")
tb_filter_links.BackColor = Color.LightGreen
tb_O1.BackColor = Color.LightGreen
End Sub
Private Sub uit_btn_filter_rechts_Click(sender As Object, e As EventArgs) Handles uit_btn_filter_rechts.Click
SerialPort1.Write("k")
tb_filter_rechts.BackColor = Color.LightGreen
tb_O3.BackColor = Color.LightGreen
End Sub
Private Sub uit_btn_verwarming_Click(sender As Object, e As EventArgs) Handles uit_btn_verwarming.Click
SerialPort1.Write("l")
tb_verwarming.BackColor = Color.LightGreen
tb_OL1.BackColor = Color.LightGreen
End Sub
Private Sub uit_btn_koeling_Click(sender As Object, e As EventArgs) Handles uit_btn_koeling.Click
SerialPort1.Write("m")
tb_koeling.BackColor = Color.LightGreen
tb_OL3.BackColor = Color.LightGreen
End Sub
Private Sub aan_btn_ventilator_Click(sender As Object, e As EventArgs) Handles aan_btn_ventilator.Click
SerialPort1.Write("N")
tb_ventilator.BackColor = Color.LightCoral
tb_B2.BackColor = Color.Red
End Sub
Private Sub uit_btn_ventilator_Click(sender As Object, e As EventArgs) Handles uit_btn_ventilator.Click
SerialPort1.Write("n")
tb_ventilator.BackColor = Color.LightGreen
tb_B2.BackColor = Color.LightGreen
End Sub
Private Sub aan_btn_co2_dosering_Click(sender As Object, e As EventArgs) Handles aan_btn_co2_dosering.Click
SerialPort1.Write("R")
tb_co2_dosering.BackColor = Color.LightCoral
tb_B1.BackColor = Color.Red
End Sub
Private Sub aan_btn_230v_reserve_1_Click(sender As Object, e As EventArgs) Handles aan_btn_230v_reserve_1.Click
SerialPort1.Write("S")
tb_230v_reserve1.BackColor = Color.LightCoral
tb_B10.BackColor = Color.Red
End Sub
Private Sub aan_btn_230v_reserve_2_Click(sender As Object, e As EventArgs) Handles aan_btn_230v_reserve_2.Click
SerialPort1.Write("T")
tb_230v_reserve2.BackColor = Color.LightCoral
tb_B11.BackColor = Color.Red
End Sub
Private Sub aan_btn_ledspot_rechts_Click(sender As Object, e As EventArgs) Handles aan_btn_ledspot_rechts.Click
SerialPort1.Write("W")
tb_ledspot_rechts.BackColor = Color.LightCoral
tb_R5.BackColor = Color.Red
End Sub
Private Sub aan_btn_230v_reserve_5_Click(sender As Object, e As EventArgs) Handles aan_btn_230v_reserve_5.Click
SerialPort1.Write("X")
tb_230v_reserve5.BackColor = Color.LightCoral
tb_OR6.BackColor = Color.Red
End Sub
Private Sub aan_btn_230v_reserve_6_Click(sender As Object, e As EventArgs) Handles aan_btn_230v_reserve_6.Click
SerialPort1.Write("Y")
tb_230v_reserve6.BackColor = Color.LightCoral
tb_OR2.BackColor = Color.Red
End Sub
Private Sub aan_btn_circulatie_Click(sender As Object, e As EventArgs) Handles aan_btn_circulatie.Click
SerialPort1.Write("Z")
tb_circulatie.BackColor = Color.LightCoral
tb_L2.BackColor = Color.Red
End Sub
Private Sub aan_btn_opvoerpomp_Click(sender As Object, e As EventArgs) Handles aan_btn_opvoerpomp.Click
SerialPort1.Write("O")
tb_opvoerpomp.BackColor = Color.LightCoral
tb_L4.BackColor = Color.Red
End Sub
Private Sub aan_btn_bodemverw_rechts_Click(sender As Object, e As EventArgs) Handles aan_btn_bodemverw_rechts.Click
SerialPort1.Write("P")
tb_bodemverw_rechts.BackColor = Color.LightCoral
tb_OR3.BackColor = Color.Red
End Sub
Private Sub aan_btn_co2_reactor_Click(sender As Object, e As EventArgs) Handles aan_btn_co2_reactor.Click
SerialPort1.Write("U")
tb_co2_reactor.BackColor = Color.LightCoral
tb_OL6.BackColor = Color.Red
End Sub
Private Sub uit_btn_opvoerpomp_Click(sender As Object, e As EventArgs) Handles uit_btn_opvoerpomp.Click
SerialPort1.Write("o")
tb_opvoerpomp.BackColor = Color.LightG
3 answers
Sort by: Most helpful
-
Stan De Smedt 1 Reputation point
2022-12-07T18:00:07.057+00:00 -
-