|
On Mon, 26 Mar 2001, Ross Crawford wrote:
> yego,
>
> The wait_event function takes an event function as the first parameter, not
> a sensor number. You need something like (forgive any errors - I don't have
> LegOS available at work)
>
> int rotation_event_3(wakeup_t data)
> {
> if (SENSOR_3 == data)
[etc.]
Also, don't you use ROTATION_X instead of SENSOR_X once you get the
rotation sensor set up on that port? I thought it was something like that.
I'd also like to comment that this is dangerous. It's theoretically
possible that your sensor check will miss the 2 position, getting called
on 1 and then 3. Your wheel would probably have to be going fast, or you'd
have a ton of tasks running, but I personally would be more comfortable
programming it a bit more defensively using a <= or similar. Of course,
these are all issues to worry about after the code actually *works*. :)
--
"From now on, we live in a world where man has walked on the moon.
And it's not a miracle, we just decided to go." -- Jim Lovell
Mike Ash - <http://www.mikeash.com/>, <mailto:mail@mikeash.com>
|
|
Message is in Reply To:
| | Re: code
|
| yego, The wait_event function takes an event function as the first parameter, not a sensor number. You need something like (forgive any errors - I don't have LegOS available at work) int rotation_event_3(wakeup_t data) { if (SENSOR_3 == data) return (...) (24 years ago, 26-Mar-01, to lugnet.robotics.rcx.legos)
|
3 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|