|
Ben Fleskes wrote:
>
> The program looks for input from the message buttons on the infrared remote.
> Message 1 decreases speed, Message 2 sets the speed to 0, and Message 3
> increases the speeed. On problem I have is that when I give it message 2, the
> variable 'speed' goes to zero but the motor doesn't stop. Anyone know what I'm
> doing wrong? Anyone have suggestions for refining the code. Perhaps a better
> speed control algorithem. Thanks to Dave B(for NCQ) and Mark Overmars (for the
> tutorial)
>
> Thanks for any advice, hints, feedback or suggestions
>
> Here is the code: (please excuse me if it is not appropriate to post it here)
>
> int speed , __speed;
>
> task run_motor()
> {
> while (true)
> {
> __speed = speed;
>
> if (__speed > 0) {SetPower(OUT_A,speed);OnFwd(OUT_A);}
> if (__speed < 0) {SetPower(OUT_A,-speed);OnRev(OUT_A);}
> }
> }
you never check if your speed is 0 in this task - IMO, you need to add:
if (__speed == 0) {Off(OUT_A)};
(I'm guessing here, since I haven't really done any NCQ myself yet. :/
Dan
|
|
Message has 1 Reply:
Message is in Reply To:
84 Messages in This Thread: ![infrared remote control of LEGO trains using NCQ and RCX -Ben Fleskes (22-Mar-00 to lugnet.robotics.rcx.nqc, lugnet.trains)](/news/x.gif) ![](/news/246.gif) ![You are here](/news/here.gif) ![](/news/46.gif) ![Re: infrared remote control of LEGO trains using NCQ and RCX -Ben Fleskes (22-Mar-00 to lugnet.robotics.rcx.nqc, lugnet.trains)](/news/x.gif)
![](/news/x.gif) ![](/news/268.gif) ![Re: infrared remote control of LEGO trains using NCQ and RCX -Reinhard "Ben" Beneke (22-Mar-00 to lugnet.robotics.rcx.nqc, lugnet.trains)](/news/x.gif) ![](/news/246.gif) ![Re: infrared remote control of LEGO trains using NQC and RCX -Ben Fleskes (22-Mar-00 to lugnet.robotics.rcx.nqc, lugnet.trains)](/news/x.gif) ![](/news/246.gif) ![Re: infrared remote control of LEGO trains using NQC and RCX -Ludo Soete (22-Mar-00 to lugnet.robotics.rcx.nqc, lugnet.trains)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: infrared remote control of LEGO trains using NQC and RCX -Reinhard "Ben" Beneke (22-Mar-00 to lugnet.robotics.rcx.nqc, lugnet.trains)](/news/x.gif) ![](/news/246.gif) ![Re: infrared remote control of LEGO trains using NQC and RCX -Larry Pieniazek (22-Mar-00 to lugnet.robotics.rcx.nqc, lugnet.trains)](/news/x.gif) ![](/news/46.gif) ![Re: infrared remote control of LEGO trains using NQC and RCX -John Neal (23-Mar-00 to lugnet.trains)](/news/x.gif) ![](/news/246.gif) ![Re: infrared remote control of LEGO trains using NQC and RCX -James Powell (23-Mar-00 to lugnet.trains)](/news/x.gif) ![](/news/246.gif) ![Re: infrared remote control of LEGO trains using NQC and RCX -Frank Filz (23-Mar-00 to lugnet.trains)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/268.gif) ![Re: infrared remote control of LEGO trains using NQC and RCX -Larry Pieniazek (23-Mar-00 to lugnet.trains)](/news/x.gif) ![](/news/246.gif) ![Re: infrared remote control of LEGO trains using NQC and RCX -John Neal (23-Mar-00 to lugnet.trains)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/268.gif) ![Re: infrared remote control of LEGO trains using NQC and RCX -James Powell (23-Mar-00 to lugnet.trains)](/news/x.gif) ![](/news/46.gif) ![Re: infrared remote control of LEGO trains using NQC and RCX -Larry Pieniazek (23-Mar-00 to lugnet.trains)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: infrared remote control of LEGO trains using NQC and RCX -Stacy J. Bledsoe (23-Mar-00 to lugnet.trains)](/news/x.gif) ![](/news/46.gif) ![Re: infrared remote control of LEGO trains using NQC and RCX -Larry Pieniazek (23-Mar-00 to lugnet.trains)](/news/x.gif) ![](/news/46.gif) ![Re: infrared remote control of LEGO trains using NQC and RCX -Stacy J. Bledsoe (23-Mar-00 to lugnet.trains)](/news/x.gif) ![](/news/46.gif) ![Re: infrared remote control of LEGO trains using NQC and RCX -Stacy J. Bledsoe (23-Mar-00 to lugnet.trains)](/news/x.gif) ![](/news/46.gif) ![Re: infrared remote control of LEGO trains using NQC and RCX -Larry Pieniazek (24-Mar-00 to lugnet.trains)](/news/x.gif) ![](/news/46.gif) ![Re: infrared remote control of LEGO trains using NQC and RCX -Michel Magnan (24-Mar-00 to lugnet.trains)](/news/x.gif) ![](/news/46.gif) ![Re: infrared remote control of LEGO trains using NQC and RCX -Stacy J. Bledsoe (26-Mar-00 to lugnet.trains)](/news/x.gif) ![](/news/46.gif) ![Jawn Henry construction notes (was Re: infrared remote control of LEGO trains using NQC and RCX -Larry Pieniazek (27-Mar-00 to lugnet.trains)](/news/x.gif) ![](/news/46.gif) ![Re: Jawn Henry construction notes (was Re: infrared remote control of LEGO trains using NQC and RCX -Christopher Masi (27-Mar-00 to lugnet.trains)](/news/x.gif) ![](/news/46.gif) ![Re: Jawn Henry construction notes (was Re: infrared remote control of LEGO trains using NQC and RCX -Stacy J. Bledsoe (27-Mar-00 to lugnet.trains)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: infrared remote control of LEGO trains using NQC and RCX -John Neal (23-Mar-00 to lugnet.trains)](/news/x.gif) ![](/news/46.gif) ![Re: infrared remote control of LEGO trains using NQC and RCX -Larry Pieniazek (24-Mar-00 to lugnet.trains)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: infrared remote control of LEGO trains using NQC and RCX -Frank Filz (23-Mar-00 to lugnet.trains)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/268.gif) ![More Train Thoughts - was remote control -Ralph Hempel (22-Mar-00 to lugnet.trains)](/news/x.gif) ![](/news/46.gif) ![Re: More Train Thoughts - was remote control -Frank Filz (22-Mar-00 to lugnet.trains)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![roundhouse discussion: was: Re: infrared remote control of LEGO trains using NQC and RCX -Ben Fleskes (22-Mar-00 to lugnet.trains)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/68.gif) ![New LEGO train realism? (was:Re:infrared remote control of LEGO trains using NCQ and RCX) -John Neal (22-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif) ![](/news/246.gif) ![Re: New LEGO train realism -John Gerlach (22-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: New LEGO train realism? (was:Re:infrared remote control of LEGO trains using NCQ and RCX) -Reinhard "Ben" Beneke (22-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif) ![](/news/246.gif) ![Re: New LEGO train realism? (was:Re:infrared remote control of LEGO trains using NCQ and RCX) -Larry Pieniazek (22-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif) ![](/news/46.gif) ![Re: New LEGO train realism? -Reinhard "Ben" Beneke (22-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif) ![](/news/246.gif) ![Re: New LEGO train realism? -Ben Fleskes (22-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/268.gif) ![module standards -Christopher Tracey (22-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: New LEGO train realism? -Larry Pieniazek (22-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif) ![](/news/46.gif) ![Re: New LEGO train realism? -James J. Trobaugh (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif) ![](/news/246.gif) ![Re: New LEGO train realism? -John Gerlach (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif) ![](/news/246.gif) ![Re: New LEGO train realism? -James J. Trobaugh (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: New LEGO train realism? -Christopher Masi (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: New LEGO train realism? -Ben Fleskes (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif) ![](/news/246.gif) ![Re: New LEGO train realism? -Dean Husby (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif) ![](/news/246.gif) ![Re: New LEGO train realism? -Larry Pieniazek (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/268.gif) ![Re: New LEGO train realism? -Ben Fleskes (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: New LEGO train realism? -Mike Walsh (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/268.gif) ![Club Table Standards was Re: New LEGO train realism? -James J. Trobaugh (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif) ![](/news/46.gif) ![Re: Club Table Standards was Re: New LEGO train realism? -Christopher Tracey (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif) ![](/news/46.gif) ![Re: Club Table Standards was Re: New LEGO train realism? -James J. Trobaugh (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif) ![](/news/46.gif) ![Re: Club Table Standards was Re: New LEGO train realism? -James J. Trobaugh (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: New LEGO train realism? -Kevin Wilson (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: New LEGO train realism? -John Gerlach (22-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif) ![](/news/246.gif) ![Re: New LEGO train realism? -Reinhard "Ben" Beneke (22-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif) ![](/news/46.gif) ![Re: New LEGO train realism? -Daniel Siskind (22-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/268.gif) ![GMLTC Storm Watch 2000 -John Kelly (22-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/268.gif) ![Re: New LEGO train realism? -John Matthews (22-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif) ![](/news/46.gif) ![Re: New LEGO train realism? -John Gerlach (22-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif) ![](/news/246.gif) ![Re: New LEGO train realism? -Mike Poindexter (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif) ![](/news/46.gif) ![Re: New LEGO train realism? -John Gerlach (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif) ![](/news/246.gif) ![Re: New LEGO train realism? -Charles Eric McCarthy (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: New LEGO train realism? -Larry Pieniazek (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif) ![](/news/46.gif) ![Re: New LEGO train realism? -Daniel Siskind (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif) ![](/news/46.gif) ![Re: New LEGO train realism? -Larry Pieniazek (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: New LEGO train realism? -John Matthews (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: New LEGO train realism? -Tom Stangl (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif) ![](/news/246.gif) ![Re: New LEGO train realism? -John Gerlach (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif) ![](/news/246.gif) ![Re: New LEGO train realism? -Larry Pieniazek (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: New LEGO train realism? -Mike Poindexter (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif) ![](/news/46.gif) ![Re: New LEGO train realism? -Larry Pieniazek (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif) ![](/news/246.gif) ![Re: New LEGO train realism? -John Kelly (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif) ![](/news/246.gif) ![Re: New LEGO train realism? -Mike Poindexter (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif) ![](/news/46.gif) ![Re: New LEGO train realism? -John Gerlach (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif) ![](/news/246.gif) ![Legomodular standards -Larry Pieniazek (23-Mar-00 to lugnet.trains.org)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: New LEGO train realism? -Mike Poindexter (23-Mar-00 to lugnet.trains.org)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: New LEGO train realism? -Larry Pieniazek (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif) ![](/news/246.gif) ![Re: New LEGO train realism? -John Gerlach (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: New LEGO train realism? -John Kelly (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif) ![](/news/46.gif) ![Re: New LEGO train realism? -Mike Poindexter (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/268.gif) ![Re: New LEGO train realism? -Brian Williams (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: New LEGO train realism? -Reinhard "Ben" Beneke (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: New LEGO train realism? -Larry Pieniazek (23-Mar-00 to lugnet.trains, lugnet.trains.org)](/news/x.gif)
![](/news/x.gif) ![](/news/68.gif) ![Re: infrared remote control of LEGO trains using NCQ and RCX -Dean Husby (22-Mar-00 to lugnet.robotics.rcx.nqc, lugnet.trains)](/news/x.gif)
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|