NXC SetSensorHTEOPD issue

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

NXC SetSensorHTEOPD issue

Post by HaWe »

hey,
I get compile error for SetSensorHTEOPD:

SetSensorHTEOPD(2) => error: "," expected
SetSensorHTEOPD(2, bStandard) => error: undefined identifier bStandard
mightor
Site Admin
Posts: 1079
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands
Contact:

Re: NXC SetSensorHTEOPD issue

Post by mightor »

Did you declare bStandard or is it some kind of unknown variable? Should probably be set to true or false or whatever NXC uses for boolean symbols. It has to do with the short and long range setting for the EOPD.

= Xander
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: NXC SetSensorHTEOPD issue

Post by HaWe »

bStandard is a parameter which is named and chosen in the integrated help and it appeared to me if it was sort of a predefined system variable - what it actually isn't.
I already supposed that it was meant for long or short range but there is no information about what this value is likeor of what amount, concerning also the alternative value.
Unfortunately the explanation and the programming example are not correct in either way.
mightor
Site Admin
Posts: 1079
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands
Contact:

Re: NXC SetSensorHTEOPD issue

Post by mightor »

The b in bStandard indicates a boolean, so it can only be one of two values. s means string, i means int, l means long, d means double, f means float, c is char, etc :)

= Xander
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: NXC SetSensorHTEOPD issue

Post by HaWe »

aah, alright, so bStandard is supposed to be "true" for "short range"...
(maybe the NXC documentation team finds sometimes time to update this help file issue...^^)
mightor
Site Admin
Posts: 1079
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands
Contact:

Re: NXC SetSensorHTEOPD issue

Post by mightor »

A more intuitive name would maybe be bShortRange :)

= Xander
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: NXC SetSensorHTEOPD issue

Post by HaWe »

bShortRangeTrue
^^
mightor
Site Admin
Posts: 1079
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands
Contact:

Re: NXC SetSensorHTEOPD issue

Post by mightor »

No, putting an actual value in your name is bad practice; bShortRangeTrue = false ? That just look awful.

= Xander
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: NXC SetSensorHTEOPD issue

Post by HaWe »

as it's a constant it might be acceptable.

Code: Select all

#define bShortRangeTrue true
#define bShortRangeFalse  false
#define bLongRangeTrue false
#define bLongRangeFalse true 
:mrgreen: :ugeek: :mrgreen:

bShortRangeTrue <=> ShortRange
bLongRangeTrue <=> LongRange

bShortRangeFalse == ! bShortRangeTrue
bLongRangeFalse == ! bLongRangeTrue
bShortRangeTrue == true == bLongRangeFalse
bShortRangeTrue == ! bShortRangeFalse == ! (! bLongRangeFalse) == bLongRangeFalse :P

:mrgreen: :ugeek: :mrgreen:

anyway, anything is better than an undocumented bStandard :D
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: NXC SetSensorHTEOPD issue

Post by afanofosc »

HiTechnic refers to "standard range" and "long range" modes of operation. There is no such thing as a "short range" mode. The only defect here is that the sample program was not updated when the ability to set the mode was added as a required parameter to the API function that configures the sensor.

As with any third party device you should consult the documentation provided by the manufacture for information about how it operates.

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests