hi, i have facing some problems in my joystick code. it cant run correctly
and will not return to its center point. hope someone can help me. below is
the code:
Private Sub tmrContinuousDataCollect_Tick(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles tmrContinuousDataCollect.Tick
Dim BoxRECT As RECT
Dim ShipRECT As RECT
Dim TempRECT As RECT
Dim i As Integer
Dim x1 As Integer
Dim y1 As Integer
Dim z1 As Integer
Dim r1 As Integer
'Dim FailedBoost As Boolean
'Static Boosted As Boolean
PollJoystick()
If CurrentJoyX CenterX And HScrollBar1.Value < 250 Then
HScrollBar1.Value = HScrollBar1.Value + 1
x1 = HScrollBar1.Value + 25 'To prevent error
Label2.Text = x1.ToString
ExchangeInputAndOutputReports()
ElseIf CurrentJoyX < CenterX And HScrollBar1.Value 83 Then
HScrollBar1.Value = HScrollBar1.Value - 1
x1 = HScrollBar1.Value + 25
Label2.Text = x1.ToString
ExchangeInputAndOutputReports()
End If
If CurrentJoyY CenterY And HScrollBar2.Value < 250 Then
HScrollBar2.Value = HScrollBar2.Value + 1
y1 = HScrollBar2.Value + 25
Label3.Text = y1.ToString
ExchangeInputAndOutputReports()
ElseIf CurrentJoyY < CenterY And HScrollBar2.Value 83 Then
HScrollBar2.Value = HScrollBar2.Value - 1
y1 = HScrollBar2.Value + 25
Label3.Text = y1.ToString
ExchangeInputAndOutputReports()
End If
If CurrentJoyZ CenterZ And HScrollBar3.Value < 250 Then
HScrollBar3.Value = HScrollBar3.Value + 1
z1 = HScrollBar3.Value + 25
Label5.Text = z1.ToString
ExchangeInputAndOutputReports()
ElseIf CurrentJoyZ < CenterZ And HScrollBar3.Value 83 Then
HScrollBar3.Value = HScrollBar3.Value - 1
z1 = HScrollBar3.Value + 25
Label5.Text = z1.ToString
ExchangeInputAndOutputReports()
End If
If CurrentJoyR CenterR And HScrollBar4.Value < 250 Then
HScrollBar4.Value = HScrollBar4.Value + 1
r1 = HScrollBar4.Value + 25
Label7.Text = r1.ToString
ExchangeInputAndOutputReports()
ElseIf CurrentJoyR < CenterR And HScrollBar4.Value 83 Then
HScrollBar4.Value = HScrollBar4.Value - 1
r1 = HScrollBar4.Value + 25
Label7.Text = r1.ToString
ExchangeInputAndOutputReports()
End If
End Sub
TQ.
cson
url:http://www.ureader.com/gp/1444-1.aspx