To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.nxtOpen lugnet.robotics.nxt in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / NXT / 991
990  |  992
Subject: 
Re: Nxc and Mindsensors stuff
Newsgroups: 
lugnet.robotics.nxt
Date: 
Tue, 27 Nov 2007 11:20:03 GMT
Viewed: 
29496 times
  
John Hansen wrote:
I do not have the mindsensors DROD-Nx sensor but I have read the documentation
from their website.  It says that the sensor is an analog sensor which you can
read using the standard NXT-G light sensor block.  That means you need to
configure the sensor port as an active light sensor and then simply read its
value.

I also compiled a simple NXT-G program containing one DROD sensor block and
examined the decompiled .rxe file using BricxCC.  It shows that the
mindsensors.com block uses the NormalizedValue sensor reading.  So in NXC you
can simply do this:

task main() {
  SetSensorType(S1, SENSOR_TYPE_LIGHT_ACTIVE);
  SetSensorMode(S1, SENSOR_MODE_PERCENT);
  ResetSensor(S1);
  while (true) {
    NumOut(0, LCD_LINE1, SensorNormalized(S1), true);
    Wait(100);
  }
}


Hope this helps,
John Hansen

Well, I use Linux so I completely skipped the part about NXT-G in the
docs and I missed the reference to the light sensor. Anyway, that is
sort of what I tried (I changed the original program so many times I am
not sure).

But probably I missed something because I got some results with this:

task main ()
{
SetSensorType(IN_2, SENSOR_TYPE_LIGHT_ACTIVE);
SetSensorMode(S2, SENSOR_MODE_PERCENT);
ResetSensor(S2);
while(!ButtonPressed(BTNCENTER,true))
{ NumOut(20, LCD_LINE3, Sensor(S2), true);
   Wait(100);
}
}

Using SensorNormalized() gives values around 350 while Sensor gives what
  the doc says ~33, ~77, ~66 . It doesn't seem to be too reliable 'tho,
as  it doesn't really detect where the objects are that well and they
have to be really close (<5cm). But at least I got something!

Thanks!

GianPiero



Message has 1 Reply:
  Re: Nxc and Mindsensors stuff
 
(...) Thank you! But it worked only after firmware upgrade (to version 1.05) and using original NXT flat cables (Mindsensors flat cables are very poor quality). -- alf (17 years ago, 30-Nov-07, to lugnet.robotics.nxt)

Message is in Reply To:
  Re: Nxc and Mindsensors stuff
 
(...) I do not have the mindsensors DROD-Nx sensor but I have read the documentation from their website. It says that the sensor is an analog sensor which you can read using the standard NXT-G light sensor block. That means you need to configure the (...) (17 years ago, 27-Nov-07, to lugnet.robotics.nxt)

8 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR