To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 23078
23077  |  23079
Subject: 
why doesn't this work?
Newsgroups: 
lugnet.robotics
Date: 
Tue, 30 Nov 2004 21:18:03 GMT
Viewed: 
1000 times
  
I've written a program to record the timing of a rotation sensor changing in an
array, but all I get out is zero's and the occaisonal 1 or 4. I've checked
several things but can't find any obvious problem. The program compiles and runs
perfectly and their are no parrallel tasks running. why doesn't it work?

Steve

void init()
       {
       OnFwd(OUT_A);
       Wait(150);
       Float(OUT_A);
       int oldsensor=SENSOR_1;
       int temp;

       int inc=0;
       while(timeout<2000)
          {
          temp =  SENSOR_1;
          if(temp != oldsensor)
             {
             if(inc<27){array[inc] = timeout;
             }
             timeout=0;
             inc=inc+1;
             oldsensor=temp;
             }
          else
             {timeout++;}
          }
          start checkvar;
       }



Message has 1 Reply:
  Re: why doesn't this work?
 
(...) What is the value of inc when you're done? And, is SENSOR_1 defined as a rotation sensor? (and active?) Steve (20 years ago, 30-Nov-04, to lugnet.robotics)

9 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    
Active threads in Robotics

 
Contact Recovery Nerd for Speedy USDT / BTC Recovery
14 hours ago
Custom Search

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