IRSeekerV2 Again...plz

This is where you talk about the NXJ hardware related topics such as the brick, sensors, LEGO pieces, etc.

Moderators: roger, imaqine, 99jonathan

fofa
New User
Posts: 6
Joined: Thu Mar 17, 2011 2:37 pm

IRSeekerV2 Again...plz

Postby fofa » Sat Mar 19, 2011 10:03 pm

Code: Select all

package lejos.nxt.addon;
import lejos.nxt.*;
import lejos.nxt.I2CSensor;
public class IRSeekerV2 extends  I2CSensor {

   public static enum Mode{
      AC,DC
   };
   public static final byte address=0x08;
   byte[] buf=new byte[1];
   private Mode mode;
   public void setMode(Mode mode)
   {
      this.mode=mode;
   }
   public IRSeekerV2(I2CPort port,Mode mode)
   {
      super(port, I2CPort.STANDARD_MODE);
      setMode(mode);
      setAddress(address);
   }
   
   
   public int getDirection()
   {
      int register=0;
      if(mode==Mode.AC)
      {
         register=0x49;
      }
      else if(mode==Mode.DC){
         register=0x42;
      }
      int ret=getData(register,buf,1);
      if(ret != 0)
      return -1;
      return(0xFF & buf[0]);
      
   }
    private static IRSeekerV2 seeker=new IRSeekerV2(SensorPort.S2, Mode.DC );
   public static void main(String[] args)
   {
      seeker.setAddress(0x08);
                     int direction = seeker.getDirection();
      LCD.drawInt(direction, 0,7);
                        LCD.refresh();

   }
      
}


hi
when i run and debug this code i find this erorr

Code: Select all

Multiple Markers at this line
watchpoint:IRSeekerV2[access and modification]-seeker
debug call stack

plz can tell me why?

fofa
New User
Posts: 6
Joined: Thu Mar 17, 2011 2:37 pm

Re: IRSeekerV2 Again...

Postby fofa » Mon Mar 21, 2011 4:21 pm

plz can tell my why this error :(


Exception in thread "main" java.lang.UnsatisfiedLinkError: lejos.nxt.SensorPort.setPowerTypeById(II)V
at lejos.nxt.SensorPort.setPowerTypeById(Native Method)
at lejos.nxt.SensorPort.setPowerType(SensorPort.java:947)
at lejos.nxt.SensorPort.setType(SensorPort.java:856)
at lejos.nxt.SensorPort.reset(SensorPort.java:752)
at lejos.nxt.SensorPort.<init>(SensorPort.java:736)
at lejos.nxt.SensorPort.<clinit>(SensorPort.java:78)
at lejos.nxt.addon.IRSeekerV2.main(IRSeekerV2.java:46)

User avatar
gloomyandy
leJOS Team Member
Posts: 4698
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: IRSeekerV2 Again...plz

Postby gloomyandy » Mon Mar 21, 2011 8:28 pm

That looks like you are trying to run code designed for an NXT on a PC. You can't do this. Nor can you use the debug facilities in Eclipse or NetBeans to debug NXT programs.

fofa
New User
Posts: 6
Joined: Thu Mar 17, 2011 2:37 pm

Re: IRSeekerV2 Again...plz

Postby fofa » Mon Mar 21, 2011 9:15 pm

yes i use Eclipse

User avatar
gloomyandy
leJOS Team Member
Posts: 4698
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: IRSeekerV2 Again...plz

Postby gloomyandy » Mon Mar 21, 2011 9:50 pm

When asking for help the more you explain what it is you want to do, what it is you have done, what happens, and what you expected, the more likely you are to get help... If you make it hard for people to work out what you are doing, they will simply move on...

Andy


Return to “NXJ Hardware”

Who is online

Users browsing this forum: No registered users and 1 guest