Sample code for comms with WiTilt V3 please?

Have just received a WiTiltV3 and having troubles communicating with the unit over bluetooth. Have Vista so no terminal program but writing comms program in VB6 from scratch. I can get the WiTilt menu up sometimes and even a data stream but it is very patchy. Most of the time does not run and then all of a sudden after 5 or 6 resets it sends data and then stops and have to reset, close my program and start all over again.

Does anyone some sample comms code in VB, C, C# or any other language for that matter for the WiTilt?

Thanks

Having similar problems here as well. I think it is the bluetooth stack. However, would be glad to have a look at your code and share back what I have developed. So far I am unable to get any terminal program to connect as it always asks for a passkey. What bluetooth adapter are you using?

If you download Hyperterminal, I got a trial 30 days but open up the bluetooth conection and see what port it is using and then open hyperterminal and connect to that port, myne is port 10, and then once it connects i hit enter and the tilt menu showed up, and it dispays raw data… i am also having problem finding a program to dispay the output in a graph, i like the raw data but i cant find anything that will work, so if any help would be much appreciated. thanks

I now have the Witilt working well with a VB program I have written. Here are the main functions to setup and gather data.

Option Explicit

Public Function OpenAccelerometerPort() As Boolean

'opens the accelerometer port and returns true or false if successful

If frmAnalysis.MSCommAccelerometer.PortOpen Then frmAnalysis.MSCommAccelerometer.PortOpen = False

DoEvents

With frmAnalysis.MSCommAccelerometer

.CommPort = accelcomportnum

'.PortOpen = True

.Settings = “115200,N,8,1”

.InputLen = 0

End With

DoEvents

'test to see if opened and running

If frmAnalysis.MSCommAccelerometer.PortOpen Then

OpenAccelerometerPort = True

Else

OpenAccelerometerPort = True

End If

End Function

Public Sub CollectAccelerometerData(start As Boolean)

'turn data stream from accelerometer on or off

'check to see if port is open

If frmAnalysis.MSCommAccelerometer.PortOpen = False Then OpenAccelerometerPort

If start Then

'start collecting accelerometer data

’ Send the command to the accelerometer to begin data send.

SendToAccelerometer (accelstart)

starttime = timeGetTime

accelbuffer = “”

accelst = 1

samplecount = 0

prevsamplecount = 0

Else

'stop accelerometer data collection

SendToAccelerometer (accelstart)

End If

End Sub

Public Function GetAccelerometerData() As String

'retrieves the contents of the accelerometer comms port buffer

Dim intext As String

If frmAnalysis.MSCommAccelerometer.PortOpen = False Then Exit Function

Do

intext = intext + frmAnalysis.MSCommAccelerometer.Input

DoEvents

Loop While frmAnalysis.MSCommAccelerometer.InBufferCount >= 1

GetAccelerometerData = intext

End Function

Public Sub SendToAccelerometer(txt As String)

'send the txt to the accelerometer

If frmAnalysis.MSCommAccelerometer.PortOpen Then

frmAnalysis.MSCommAccelerometer.Output = txt

DoEvents

End If

End Sub

Now you can move on to using serial port events rather than polling.

Much cleaner.