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 / 1791
1790  |  1792
Subject: 
Re: code
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Mon, 26 Mar 2001 03:49:55 GMT
Viewed: 
1317 times
  
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 1;
else
  return 0;
}

and change the wait_event line to:
  wait_event(rotation_event_3,2);

HTH

ROSCO

yego <ldaniel2@prodigy.net> wrote in message news:GAsBzK.8r7@lugnet.com...
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
 
(...) [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 (...) (23 years ago, 26-Mar-01, to lugnet.robotics.rcx.legos)

Message is in Reply To:
  code
 
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 */ (...) (23 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

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

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