Hi:
I am trying to understand why I get an error when using the bluetooth module. This error is handled, but I still want to understand what is happening.
This is with a FEZ_Raptor, and the Bluetooth 1.1 module, visual studio 2012 and VB.
The immediate window shows:
Bluetooth status OK
Then I look at the stack trace, I see that the error is in > GTM.GHIElectronics.Bluetooth.dll!Gadgeteer.Modules.GHIElectronics.Bluetooth.runReaderThread() Line 175 + 0x8b bytes C#
Clicking on this line to view the code brings the message "Bluetooth_42.cs not found"
I have done a search for this module in my PC for this module but no luck.
At this point I have bluetooth running, but I would like to understand how to better use the debugger to avoid these handled errors if possible as I imagine that handling errors slows things down.
Thanks Daniel
Now I understand how to get debugging information by downloading the source and pointing the compiler at it.
The error is shown below. After the error I printed the variables involved. You can see that last=-1 thus it does not work to parse the substring of response.
The error is in runReaderThread of Bluetooth_42.cs
I see your reference to RoSchmi’s bluetooth module, and I understand that this handles high data rates better. My application is for very low data rates, and I am not sure how to substitute the module when working in VB.net.
Hi Daniel:
I was able to get it working following your suggestions - Thanks!
I have not seen any seen the same error as with the other GHI module. Thanks RoSchmi - it seems to work well and seems stable, as far as I have tested.
I am able to maintain a robust connection to my Android phone and a free app called BTClient. I can connect and the connection will persist. My application sends a time string every second, which is shown on the phone’s screen. There is a keypad on the phone and I can enter characters which are sent and show on my T43 display attached to the Raptor.
@ rockybooth -
Hi rockybooth, I’m glad to hear that it works for you.
It would be great if you could post your adapation to visual basic here. If you agree I could include the VB adaptation in the CodeShare entry of the driver.
Cheers
Roland
I plan to post my VB version of bluetooth communications using RoSchmi’s code, buy I have run into a problem - as I want to implement both host and client modes (so I can communicate bidirectionally between two Raptor’s) - I cannot determine how to send data from a Host. There does not seem to be a SendLine routine associated with the HostMode as there is with the ClientMode. If I try to define both modes, I get an error “Cannot use both Client and Host modes for Bluetooth module”.
@ rockybooth - Great. As far as I know nobody yet posted an application where a Gadgeteer device used the bluetooth module in host mode. How did you manage the pairing?
In the hope that it helps I post a link to a application where two arduinos communicated over the identical Bluetooth module
-http://www.seeedstudio.com/wiki/index.php?title=Bluetooth_Bee#Connecting_to_Arduino_with_XBee_Shield
Cheers Roland
@ RoSchmi - I have not noticed jet that no one has used the host mode. I writing and testing my driver in the moment and only use the hoste mode to communicate with my win8 application.
Will share the driver in a few days…
@ RoSchmi, @ VB-Daniel, have either of your been able to connect to iOS devices, like the iPAD or iPhone? While I have been successful with RoSchmi’s bluetooth code for Android and PC connections, I have not had luck at all with iOS devices.
RoSchmi: I could not duplicate being able to work in host mode. It may be that I had connected in client mode to the PC and exchanged PIN at the PC OS level, then switched to host mode on the Raptor while still paired (just a guess) - of course it was late at night…
I plan on setting up a second Raptor and work on the host mode in a few days. I will try to follow the Arduino link you sent.