How to use NXT Built in Voltometer

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

Moderators: 99jonathan, roger, imaqine

How to use NXT Built in Voltometer

Postby saprager » Thu Oct 25, 2007 11:35 pm

The NXT's input ports have built in voltmeters between pins 1 and 2, colored white and black respectively on the RJ12 heads that are inserted into them. Is there a way to use leJOS to get this reading?
saprager
New User
 
Posts: 2
Joined: Thu Oct 25, 2007 11:16 pm

Postby lawrie » Fri Oct 26, 2007 10:03 am

I am not a hardware expert, but it is my understanding that the way the pins are used is different for different sensors. For Analog/Digital sensors like the Touch, Sound and Light sensors it is the digital version of this voltage reading between pins 1 and 2 that is returned as the raw sensor reading. Pins 1 and 2 are connected to the separate AVR chip which reads these values and then communicates with the main ARM chip over an I2C link and sends a packet of data for each reading. leJOS, like the standard Lego firmware, can only return what is in this packet.

To get the raw A/D value from any sensor that supports it you can use SensorPort.readRawValue, e.g:

int val = SensorPort.S1.readRawValue();
lawrie
leJOS Team Member
 
Posts: 922
Joined: Mon Feb 05, 2007 1:27 pm


Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 3 guests

more stuff