I dont have the rotation sensor and buying it would be very tough for me currently, coz I have to finish this till monday. I know for my RIS 2.0 kit in Mumbai, India...I couldnt find any shop that had it and had to ask my aunt to get it from US. Forget getting sensors alone!!

So I really need a solution that would work...and that to soon!!

On 4/14/06, Saptarshi Purkayastha <[EMAIL PROTECTED] > wrote:
I m sending u code. Its not working after casting also. its gives a value 9999 everytime. code is below.

import josx.platform.rcx.*;
import josx.robotics.*;
import josx.util.*;
import java.lang.*;

public class TestNavig
{
    public TestNavig()
    {
        TimingNavigator navig = new TimingNavigator(Motor.A, Motor.C, 2.0F, 1.48F);
        int dashCount = 0, read = 0, read2 = 0;
                int startTime = 0, travelTime = 0;
        Sensor.S1.setTypeAndMode(1, 0x20);
        Sensor.S3.setTypeAndMode(1, 0x20);
        Sensor.S1.activate();
        Sensor.S3.activate();
 
        while (dashCount==0)
        {
                    startTime = (int)System.currentTimeMillis();
                    moveForward();
                    read = Sensor.S1.readValue();
                    read2 = Sensor.S3.readValue();
                    if (read == 1 || read2 == 1)
                    {
                        Sound.beep();
                        dashCount++;
                        Motor.A.stop();
                        Motor.C.stop();
                        travelTime = startTime - ((int)System.currentTimeMillis());
                    }
        }
                LCD.showNumber(travelTime);
                try{
                 Thread.sleep(2000);
                }
                catch(Exception e){}
                Sensor.S1.passivate();
                Sensor.S3.passivate();
    }
    public static void main(String args[])
    {
        TestNavig tn = new TestNavig();
    }
    public void moveForward()
    {
        Motor.A.backward();
        Motor.C.backward();
    }
 
}

Please check it and reply me urgently.

--
Regards,
Saptarshi PURKAYASTHA

You Live by CHOICE, Not by CHANCE



--
Regards,
Saptarshi PURKAYASTHA

You Live by CHOICE, Not by CHANCE

Reply via email to