|
Hi, I'm a newbie to c++ and legOS. Here is my code. Do you know what is
wrong with it cause I don't. Thanks
/* s.c*/
#include <unistd.h>
#include <dmotor.h>
#include <dsensor.h>
int main(int argc, char **argv)
{
/* turn it on */
ds_active(&SENSOR_3);
ds_rotation_on(&SENSOR_3);
/* calibrate it to 0 */
ds_rotation_set(&SENSOR_3,0);
msleep(100);
/*start the motor*/
motor_a_dir(fwd);
wait_event(SENSOR_3,2);
motor_a_dir(brake);
return 0;
}
|
|
Message has 1 Reply: | | 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
|
|
|
|