I have a problem with the IR sensor Seeker. I was working in Netbeans and I switch to eclipse.
And to get the ball with "seeker.getDirection ();" just read "-1"
And also tell me that "seeker.setAddress(0x8);" is 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
