Class I2CSensor constructor uses undefined lejos.nxt.I2CPort

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

Moderators: 99jonathan, roger, imaqine

Class I2CSensor constructor uses undefined lejos.nxt.I2CPort

Postby kirkpthompson » Sat Dec 08, 2007 2:30 am

Hi all. In the javadoc

The I2CSensor [abstract] class constructor uses undefined lejos.nxt.I2CPort so I am wondering how to define the port the sensor is connected to? Can I use the SensorPort class statics S1, S2, ... ?

Thnx.
User avatar
kirkpthompson
leJOS Team Member
 
Posts: 304
Joined: Wed Dec 05, 2007 1:27 am
Location: New Mexico, USA

Postby lawrie » Mon Dec 10, 2007 2:04 pm

Yes you can use SensorPort as this implements the interface I2CPort. I2CPort was not made public as it is intended only to be used by the lejos.nxt package, but this is confusing in the javadocs, so we may review this.

Is there a reason why you want to use I2CSensor directly rather than one of the specific sensor classes like UltraSonicsensor which extend it?
lawrie
leJOS Team Member
 
Posts: 835
Joined: Mon Feb 05, 2007 1:27 pm

Postby kirkpthompson » Tue Dec 11, 2007 1:26 pm

Hi Lawrie et al.

Yeah, I was thinking I needed to create my own implementation for a accelerometer since the existing class doesn't offer the G values. I also may be trying to create a interface for a Alpha/Beta counter in the future. This may just turn into an simple RS-232 but at this point, I don't know.

-K
User avatar
kirkpthompson
leJOS Team Member
 
Posts: 304
Joined: Wed Dec 05, 2007 1:27 am
Location: New Mexico, USA

Postby lawrie » Sat Dec 15, 2007 11:32 am

The version in Subversion supports the G values for the mindsensors acceleration sensors, but not for the HiTechnic yet.

You are better off using the Subversion version of lejos or waiting for the next release if you are doing work on I2C devices as its support for I2C is much better (thanks to gloomyandy).

Do you plan to build a custom sensor or sensor interface yourself? Do you know if there is an I2C to RS232 converter that works with the NXT yet? There was some discussion about it on nxtasy a while back.
lawrie
leJOS Team Member
 
Posts: 835
Joined: Mon Feb 05, 2007 1:27 pm

Postby kirkpthompson » Sat Dec 15, 2007 7:31 pm

lawrie wrote:Do you plan to build a custom sensor or sensor interface yourself? Do you know if there is an I2C to RS232 converter that works with the NXT yet? There was some discussion about it on nxtasy a while back.


Hi. At this point I don't have any definite attack plan yet, just an over-arching idea. re: I2C => RS-232: If I can't find something (code), I will have to build it. I am not a hardware guy but I work with some.

So far, I'm just having alot of fun. :D
User avatar
kirkpthompson
leJOS Team Member
 
Posts: 304
Joined: Wed Dec 05, 2007 1:27 am
Location: New Mexico, USA


Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 3 guests

more stuff