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 / 1289
1288  |  1290
Subject: 
Re: Rotation Sensor Values
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Tue, 25 Jul 2000 11:39:30 GMT
Viewed: 
1631 times
  
Oops. When I copied it, that statement got left out, and I put it bck in in the
incoorect place. The original version of the code had the return in the outside
loop. I know it is this way because I could turn the rotation sensor slowly,
and see the changes in quadrants, many times.

Andy
In lugnet.robotics.rcx.legos, Eddie C. Dost writes:
#include <dsensor.h>
#include <unistd.h>
#include <conio.h>
#include <rom/lcd.h>

#include <dlcd.h>

int main(int argc,char **argv) {
ds_active(&SENSOR_2);
ds_rotation_on(&SENSOR_2);
ds_rotation_set(&SENSOR_2,0);
lcd_number(SENSOR_2,sign,e0); //show the starting number
lcd_refresh();
while(1){
lcd_number(SENSOR_2,sign,e0);
lcd_refresh();
delay(50);
return 0;
            }
}

Yes. It will only display two counter readings, then stop! See the
"return 0;" statement. It is inside the while (1) loop. Take it out of
the loop, and I am shure this one will also work. At least with 0.2.4
it does.

#include <dsensor.h>
#include <rom/lcd.h>

int main(int argc,char **argv) {
ds_active(&SENSOR_2);
ds_rotation_on(&SENSOR_2);
ds_rotation_set(&SENSOR_2,0);
while(1){
    lcd_number(ROTATION_2,sign,e0);
    msleep(50);
}
return 0;
}

Here the return statement is where you expect it to be...


Eddie C. Dost
ecd@skynet.be



Message is in Reply To:
  Re: Rotation Sensor Values
 
(...) Yes. It will only display two counter readings, then stop! See the "return 0;" statement. It is inside the while (1) loop. Take it out of the loop, and I am shure this one will also work. At least with 0.2.4 it does. (...) Here the return (...) (24 years ago, 25-Jul-00, to lugnet.robotics.rcx.legos)

16 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