Compatibility problem "LeJOS 0.9" with the sensor IRSeeker

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: 99jonathan, roger, imaqine

Compatibility problem "LeJOS 0.9" with the sensor IRSeeker

Postby nikita190 » Mon Apr 09, 2012 10:11 pm

Anyone know if "LeJOS 0.9" with the sensor IRSeeker have some compatibility issue? By using "seeker.getDirection ();" throws only -1 and also tells me that "seeker.setAddress (0x8)," not in use

Code: Select all
package com.mydomain;

import lejos.nxt.SensorPort;
import lejos.nxt.addon.CompassHTSensor;
import lejos.nxt.addon.IRSeeker;

public class HelloWorld
{
    /**
     * @param args
     */
   private static IRSeeker seeker;
   private static CompassHTSensor compas;
   

   @SuppressWarnings("deprecation")
   public static void main(String[] args)
    {
          seeker = new IRSeeker(SensorPort.S4);
          compas = new CompassHTSensor(SensorPort.S2);
          int t,g;
            while(true)
            {
               g = (int)compas.getDegrees();
               t = seeker.getDirection();
               seeker.setAddress(0x8);
               System.out.println("Grados"+g);
               System.out.println("Dir"+t);
            }       
    }
}


I'm using:
- Jdk-6u25-windows-i586
- Lejos_nxj_0.9.0
- Eclipse
- Win 7--64
nikita190
New User
 
Posts: 18
Joined: Mon Mar 26, 2012 10:48 pm

Re: Compatibility problem "LeJOS 0.9" with the sensor IRSeek

Postby skoehler » Tue Apr 10, 2012 11:22 am

Have you tried another sensor port?
Did you try to use IRSeekerV2 instead IRSeeker?

The setAddress method has been removed.
getDirection() returning -1 means, that there is an error in the I2C communication.

From the looks of it (you're trying to use address 0x8), your device is an IRSeekerV2.
skoehler
leJOS Team Member
 
Posts: 1350
Joined: Thu Oct 30, 2008 4:54 pm

Re: Compatibility problem "LeJOS 0.9" with the sensor IRSeek

Postby nikita190 » Tue Apr 10, 2012 2:02 pm

Hey.
skoehler wrote:Have you tried another sensor port?

I tried all ports and all is the same.

skoehler wrote:Did you try to use IRSeekerV2 instead IRSeeker?

Only I have in IRSeeker.

What is the difference between IRSeeker and IRSeekerV2?

Working with IRSeeker and "Lejos 0.9" how could be done to locate the ball?

Or what do you recommend here? Will changing to another version such as 0.8.5 that works?
nikita190
New User
 
Posts: 18
Joined: Mon Mar 26, 2012 10:48 pm

Re: Compatibility problem "LeJOS 0.9" with the sensor IRSeek

Postby skoehler » Tue Apr 10, 2012 2:13 pm

nikita190 wrote:
skoehler wrote:Did you try to use IRSeekerV2 instead IRSeeker?

Only I have in IRSeeker.

What is the difference between IRSeeker and IRSeekerV2?


The IRSeeker V2 has a different I2C address, and more I2C registers. Try using the class IRSeekerV2 instead of IRSeeker.
skoehler
leJOS Team Member
 
Posts: 1350
Joined: Thu Oct 30, 2008 4:54 pm

Re: Compatibility problem "LeJOS 0.9" with the sensor IRSeek

Postby nikita190 » Tue Apr 10, 2012 2:28 pm

I tried a code I found online that works with IRSeekerV2 still am testing but the values ​​displayed are fairly rational thought.

They work with two modes for AC and DC, do you me you could explain a little more about them?

Code: Select all
package com.mydomain;
import lejos.nxt.*;
import lejos.nxt.addon.IRSeekerV2;

public class HelloWorld
{
 private static IRSeekerV2 seeker;

 public static void main(String[] args)
{
 //seeker.setAddress(0x8);
 seeker = new IRSeekerV2(SensorPort.S4, IRSeekerV2.Mode.AC);

 while(true)
 {
 System.out.println(seeker.getDirection());
 }
}
}


Many thanks for all the help you have given me.
nikita190
New User
 
Posts: 18
Joined: Mon Mar 26, 2012 10:48 pm


Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 1 guest

cron
more stuff