I am writing a fairly simple program that allows me to enable/disable the air conditioning in each room of my house. I'm using a MicroLogix 1400. I have a simple button (address N10:5/5) that toggles the A/C on and off.
I want the button to say 'Enable' when N10:5/5 = 0 and 'Disable' when it = 1. I have this line of code that works fine:
If EthernetIPforPLCSLCMicroCom1.Read("N10:5/6") = True Then AptBtn.Text = "Disable" Else AptBtn.Text = "Enable"
The only problem is that I have this code written within the AptBtn.Click method. This means that it only reads the address/updates the text when I am actively clicking the button.
Long story short, is there any way to have my program continuously checking the address and updating the text accordingly? Where would I put this line of code in order to do so?
As a side note, I also tried adding this line of code directly into the button initialization, but it would break with an error every time I tried to open that page.
I am fairly new to this, so any advice is appreciated!!