To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 1790
1789  |  1791
Subject: 
code
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Mon, 26 Mar 2001 03:21:20 GMT
Viewed: 
1436 times
  
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
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR