Sensor Events not working when using CONTROLLED_MOTORCMD
MindSqualls :: Questions :: Using the sensors :: NXT sensors
Page 1 of 1
Sensor Events not working when using CONTROLLED_MOTORCMD
Hi,
I have the following problem:
When I am using the MotorControlProxy MotorControl the Events for the sensors are not working anymore
This is my code (vb.net)
The Senosor3 do not respond. I tried to do this using Events - but this was also not working :-(
When I remove then motorControl then it works fine ;-)
Who can correct my code?
Joachim
I have the following problem:
When I am using the MotorControlProxy MotorControl the Events for the sensors are not working anymore
This is my code (vb.net)
- Code:
' Create a NXT brick, USB connected
Dim Brick As NxtBrick = New NxtBrick(NxtCommLinkType.USB, 0)
' Attach a motor to port A.
Brick.MotorA = New NxtMotor()
' Attach a touch sensor to port 3.
Brick.Sensor3 = New NxtTouchSensor()
Brick.Sensor3.PollInterval = 50
Dim touchSensor As NxtTouchSensor = DirectCast(Brick.Sensor3, NxtTouchSensor)
touchSensor.PollInterval = 50
' Connect to the NXT.
Brick.Connect()
' Start the MotorControl program on the NXT and wait intill it is running.
MotorControlProxy.StartMotorControl(Brick.CommLink)
System.Threading.Thread.Sleep(500)
'Test - run MotorA
MotorControlProxy.CLASSIC_MOTORCMD(Brick.CommLink, MotorControlMotorPort.PortA, "010", "000000", "1")
Do Until True = False
touchSensor.Poll()
Brick.Sensor3.Poll()
If DirectCast(Brick.Sensor3, NxtTouchSensor).IsPressed = True Then Stop
If DirectCast(touchSensor, NxtTouchSensor).IsPressed = True Then Stop
If touchSensor.IsPressed = True Then Stop
Application.DoEvents()
Loop
' Disconnect from the NXT.
Brick.Disconnect()
The Senosor3 do not respond. I tried to do this using Events - but this was also not working :-(
When I remove then motorControl then it works fine ;-)
Who can correct my code?
Joachim
Joachim_374- Posts : 3
Join date : 2012-02-23
Similar topics
» NXT Color Sensor
» My sensor don't show zero en x-axis
» Example of how to use the NXT Acceleration / Tilt Sensor
» Tachocount not working - returns nothing or 0
» My sensor don't show zero en x-axis
» Example of how to use the NXT Acceleration / Tilt Sensor
» Tachocount not working - returns nothing or 0
MindSqualls :: Questions :: Using the sensors :: NXT sensors
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|