I am using a windows form application to interface with an arduino to turn on & off items mostly in my large garage - 2 light banks, furnace, compressor, 3 garage doors,... 12 buttons in all. I am starting the code for just 1 button to simplify things, then will expand to 12. I will put the code I came up with, along with an article on comp control where I got the idea, & pics of my hardware so far. I really do want to learn to do this, so I'm not asking for the code to be written, just let me know my mistakes & point me in the right direction! Any & all input will be greatly appreciated, I'm really excited about completion!
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
On Error Resume Next
Dim SerialPort1 As Integer
Dim Write As Object
Dim onstate, outstring As Integer
onstate = 0
If Button1.Text = "Pin 6 on" Then
Button1.Text = "Pin 6 off"
onstate = 1
outstring = "!"
If Button1.Text = "Pin 6 off" And onstate = 0 Then
Button1.Text = "Pin 6 on"
outstring = "$"
in the hardware pic, the small enclosure is a 13A 5V power supply so I can run inexpensive low voltage lines to electrical boxes with 5V relays doing the work. the middle enclosure is where the low voltage lines will hook up. there is an outlet on top, because they will be situated next to the furnace which currently plugs into a wall outlet - it will plug there. the third enclosure houses the Arduino, 9V supply for it, & relay banks that the arduino controls via VB, those relay leads go to the middle box & out to the remote relays. there is a 70' amplified USB cable running from my office to the Arduino in the garage unit. It's all very workable, I'm just new at VB & unsure of what i'm doing, but the attached article does a good job of explaining the interface. Please help!! I know there are many with a great amount of expertise out there... all I ask is that you poin me in the right direction!
. thank you for your time & patience, I know this is a long read!!