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 / 1285
1284  |  1286
Subject: 
Re: Rotation Sensor Values
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Tue, 25 Jul 2000 05:55:49 GMT
Viewed: 
1785 times
  
#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 has 1 Reply:
  Re: Rotation Sensor Values
 
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 (...) (24 years ago, 25-Jul-00, to lugnet.robotics.rcx.legos)

Message is in Reply To:
  Re: Rotation Sensor Values
 
I figured you would be glad that I was not running 0.2.4. I cannot get it to compile correctly, so I use 0.2.3 instead. The two full programs are below, in case you wanted to see them in full. Andy ----This one does not work---- #include <dsensor.h> (...) (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

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