Hi guys
i'm a little stuck with a personal project, i'm interfacing a MiniBee usb output card to my pc and having a few code problems, i am trying to control outputs 1 to 8 which requires a decimal number that relates to the binary pattern of the ouputs if that makes sense i.e
1 = output 1 on
2 = output 2 on
3= output 1 and 2 on
etc etc
So, i figured the easiest way to individually control outputs was to use public boolean vars Out1 to Out8 so i can use those anywhere in the code and use a form timer to trigger the updating of the output
So the bit im stuck on is i've done a test using 8 checkboxes to set Out 1-8 as true/false
then i've used this code:
It nearly works but i cant figure out why when i set Out2 true or Out4 true that it actually causes Output 4 on the MiniBee to turn on, also output6 is ON when a Out4 or out6 is true everything else works fine apart from that, any ideas ???
Thanks
i'm a little stuck with a personal project, i'm interfacing a MiniBee usb output card to my pc and having a few code problems, i am trying to control outputs 1 to 8 which requires a decimal number that relates to the binary pattern of the ouputs if that makes sense i.e
1 = output 1 on
2 = output 2 on
3= output 1 and 2 on
etc etc
So, i figured the easiest way to individually control outputs was to use public boolean vars Out1 to Out8 so i can use those anywhere in the code and use a form timer to trigger the updating of the output
So the bit im stuck on is i've done a test using 8 checkboxes to set Out 1-8 as true/false
then i've used this code:
VB.NET:
Private Sub DoOutputs()
Dim String1, String2, String3, String4, String5, String6, String7, String8 As String
Dim OutVal As Integer
If Out1 = True Then String1 = "1" Else String1 = "0"
If Out2 = True Then String2 = "1" Else String2 = "0"
If Out3 = True Then String3 = "1" Else String3 = "0"
If Out4 = True Then String4 = "1" Else String4 = "0"
If Out5 = True Then String5 = "1" Else String5 = "0"
If Out6 = True Then String6 = "1" Else String6 = "0"
If Out7 = True Then String7 = "1" Else String7 = "0"
If Out8 = True Then String8 = "1" Else String8 = "0"
TempOutput = ""
TempOutput = String.Concat(String8, String7, String6, String5, String4, String3, String2, String1)
OutVal = Convert.ToInt32(TempOutput)
SetOutputs(OutVal) 'set Minibee outputs
End Sub
It nearly works but i cant figure out why when i set Out2 true or Out4 true that it actually causes Output 4 on the MiniBee to turn on, also output6 is ON when a Out4 or out6 is true everything else works fine apart from that, any ideas ???
Thanks
Last edited: