Subject:
|
RE: Idea on how to interrupt RotateMotor?
|
Newsgroups:
|
lugnet.robotics.nxt
|
Date:
|
Fri, 3 Aug 2007 02:34:24 GMT
|
Viewed:
|
20865 times
|
| |
| |
Look at the following sample code:
=======================
int shut =0;
task x1()
{
TextOut(0, LCD_LINE3, "Waiting until it sees dark!...");
until (Sensor(IN_1)<40);
shut=1;
Off(OUT_AC);
}
task x2()
{
RotateMotorEx(OUT_AC, 75, 360, 0, FALSE, TRUE);
TextOut(0, LCD_LINE3, "STOPPED!...");
}
task main()
{
SetSensorLight(IN_1);
ClearSensor(IN_1);
Wait(100);
start x2;
start x1;
}
/*------ Big problem!.................
Although the motor does indeed stop turning, the call RotateMotorEx hangs. I
guess it is due to the encoder never
gets to reach 360!?
After the motor got shutoff by the task x1(), shouldn't the RotateMotorEx
simply returns right after the motor is stopped? After it returns, I should
be able to still get the rotation count so that I can make more accurate
decision making.
----*/
--E
|
|
Message is in Reply To:
| | Idea on how to interrupt RotateMotor?
|
| Since there is no event in nxc. Is there anyway to interrupt this call via a Off(OUT_AC) in another task? RotateMotor(OUT_AC, 20, 800); I could have used a time Wait after onFwd. However, This will not allow me to get a more previous degree turning. (...) (17 years ago, 3-Aug-07, to lugnet.robotics.nxt)
|
2 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
Active threads in NXT programmable brick
|
|
|
|