Iamthehor and Sonic,
I just received my FB and had been watching this thread. The problem with the "cyclic" values stems from the number of bytes you are pulling. Sonic's example has this: Dim _AllAnalogues(64) As Byte (I assumed your Dim is the same). When I use that and your sub it will eventually show the value for pin 15 as pin 14, 13, 12, 11, etc. In between it will show other crazy amounts. My guess is the dll doesn't clear the buffer (or the device doesn't) and requesting an odd number of bytes upsets it?
Change the Dim to: Dim _AllAnalogues(63) As Byte and the issue goes away. Theoretically you should probably have Dim _AllAnalogues(127) As Byte which will pull all pins from all brains (16 x 4 x 2 bytes each input)
I look forward to tinkering with this more. I see there is a digital input value type, not sure if it's actually hooked up or not. First try at reading it I get NULL. I did find out that you MUST call find all brains (or perhaps just get brain count) or else the dll doesn't work.
Amazing. I've been waiting for this solution for months, and a new member posts it in his first post lol. I'm gonna release a new version, I believe we've got a keeper.
Originally Posted by EluZioN
-fixed analog array declaration
-changed conversion formula for new baseline conversion value (from 5 to 3.3)
Glad it works. Disregard the theoretical (127) reference, it's incorrect.
Now if I could just read the values of the digital outputs before setting them life would be good :)
I'm tempted to go back to work at 11PM & try this out. THANK YOU VERY MUCH. My boss will probably not be happy with you tomorrow, however ;)
Originally Posted by EluZioN
I only had a few minutes to play around today, but this does work. the only thing I've noticed so far is that if I have 2 brains connected, only 1 will display the analog outputs, and it doesn't seem to be tied to instance. I didn't look at it very closely, but changing the instance in my display didn't shift, and initially having the form set to display the voltage/raw from instance 1 port 0 pulled the data from instance 2 port 0. I need to see what was going on there.
Originally Posted by Iamthehor
I made some progress on my days off (figured out how to read existing input status when the program starts) and will soon have a testable dll for a simpler interface with V6(s). It will contain all the needed simple functions as well as configurable triggers with an event that fires on trigger. My issue currrently is related to your issue above in which when an instance is added, another added, then removed I am not sure how to handle that in respects to the functions of the class as I didn't intend to use instances (only numbers). Bigger problem is I only have my one FB6 to test with. If you are interested in helping please drop me a line and i'll send you a copy and a demo program to try it with.
Public Sub connect()
FusionBrain_WinUSB.MainUSBClass.FindAllFusionBrains() ' as it says, finds all fusion brains connected
TotalInstances = FusionBrain_WinUSB.MainUSBClass.allFusionBrains.Count ' gets count of all fusion brains connected
FBReadTmr = New System.Windows.Forms.Timer ' initialize the timer which will read analog ports
AddHandler FBReadTmr.Tick, AddressOf FBReadTmr_Tick ' create event handler for the above timer
FBReadTmr.Interval = 250 ' set the interval for the timer to loop at 250ms
If TotalInstances > 0 Then 'if a fusion brain is found, start the read timer
FBReadTmr.Enabled = True
MsgBox("No Fusion Brain found", vbOKOnly)
Label2.Text = FusionBrain_WinUSB.MainUSBClass.allFusionBrains(1).fusionBrain_devicePathName
Label1.Text = CStr(TotalInstances)
Label2.Text = FusionBrain_WinUSB.MainUSBClass.allFusionBrains(1) .fusionBrain_devicePathName
seems to stop the sub - but it doesn't give an error. The label1.text.... statement doesn't get executed when the previous is present. Comment it out, it works. the rest of the program runs (read analogIn0 & display the digital value in a text box, turn on/off output 0 based on a checkbox)
I'm trying to identify 2 (or more) brains & make sure #1 is always connected as instance 1 & #2 is always instance 2. I'm using 62 outputs, it would be bad if the got reversed. I still don't know what _devicePathName returns, since it seems to do nothing. Any tips on a better way to do this would be appreciated.