Hi Guys, i am very new to leJOS. It's a nice language but i dosen't find any hint how i can user the IRReceiver from HiTechnic.
All i can find is code for the IRLink and the IRSeeker. Can someone help me?
greetings NoTarget
Moderators: roger, 99jonathan, imaqine
IRReceiver ir = new IRReceiver(SensorPort.S1);
value = ir.getChannelValue(2,1);
package lejos.nxt.addon;
import lejos.nxt.I2CPort;
public class IRReceiver extends IRSeeker {
byte[] buf = new byte[2];
public IRReceiver(I2CPort port) {
super(port);
}
public int getChannelValue(int channel, int stick) {
if (channel <= 0 || channel > 5) return -1;
if (stick <= 0 || stick > 2) return -1;
int ret = getData(0x42 + ((channel - 1) * 2), buf, 2);
if(ret != 0) return -1;
return (buf[stick - 1]);
}
}
Users browsing this forum: No registered users and 1 guest