Connecting GP2D12 to nxt

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

Moderators: imaqine, 99jonathan, roger

New User
Posts: 1
Joined: Sat Jul 20, 2013 3:02 pm

Connecting GP2D12 to nxt

Postby rider » Sat Jul 20, 2013 3:09 pm

Hi all,

I've seen someone explaining how to connect sharp gp2d12 to nxt: ... lit=gp2d12

but i'm not sure about how to read data, is it necessary to define the port as any kind of sensor? (light sensor?) i'm trying to read data but i don't have different values for different distances...


leJOS Team Member
Posts: 1550
Joined: Thu Oct 30, 2008 4:54 pm

Re: Connecting GP2D12 to nxt

Postby skoehler » Sat Jul 20, 2013 3:25 pm

It's an analog sensor. I assume, you have the amplifier in place already? Then you only need to set the SensorPort to the right mode and type. Call the sensorport's setTypeAndMode method to do that.

Return to “NXJ Hardware”

Who is online

Users browsing this forum: No registered users and 1 guest