Subject:
|
Switching Direction
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Wed, 18 Jun 2003 18:29:29 GMT
|
Viewed:
|
806 times
|
| |
 | |
I have a motor which drives a rack mechanism and I'm using a rotation sensor to
index my position on the rack.
When I program the motor (in NQC) to go forward I want the sensor to count up.
If the sensor then actually goes down I want to test for this condition and
correct it in software. This way I can index one end of the rack as 0 and the
other as whatever. Either the motor or the sensor could be the wrong way round.
To keep things simple I only want to switch the sensor connection not the motor
connection.
To do this I need to be able to flip the direction "forward" in the code, so if
the motor and sensor directions conflict I can correct this in software.
I tried to do this with a macro, but the compiler requires I use a constant and
not a variable. But as the test is done within the program I have to use a
variable.
So basically I'm looking for a replacement for OnFwd();
Steve
|
|
Message has 2 Replies:  | | Re: Switching Direction
|
| ----- Original Message ----- From: "Steven lane" <steveroblane@aol.com> To: <lego-robotics@crynwr.com> Sent: Wednesday, June 18, 2003 2:29 PM Subject: Switching Direction (...) sensor to (...) up. (...) and (...) the (...) round. (...) motor (...) (...) (22 years ago, 19-Jun-03, to lugnet.robotics)
|
4 Messages in This Thread:     
  
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|