Subject:
|
Re: Compass sensor with NXC
|
Newsgroups:
|
lugnet.robotics.nxt
|
Date:
|
Thu, 28 Feb 2008 23:20:39 GMT
|
Viewed:
|
31840 times
|
| |
| |
In lugnet.robotics.nxt, John Hansen wrote:
> In lugnet.robotics.nxt, Karen Lepper wrote:
> > Hello,
> >
> > I coach a Robofest high school team, and we're using two NXT robots for the
> > current challenge, programmed with NXC.
> >
> > We've been having a problem using the Compass sensor with NXC. If I use the
> > view function on the brick (selecting Ultrsonic sensor cm), it registers
> > direction just fine (from 1 to 179, and then ???).
> >
> > But when we try to use the compass sensor in NXC,we get odd results (numbers
> > into the high hundreds
>
>
> Which compass sensor are you using, the HiTechnic one or the Mindsensors one?
> Are you using a low level API function to read its value or are you using one of
> the newer API functions specific to the compass sensor?
>
> Can you email me your program and give me a bit more detail about which type of
> compass you have?
>
> John Hansen
Hi John,
We're using the HiTechnic sensor. I've contacted you directly with a copy of
the program, and here it is if anyone else has an idea for us:
task main()
{
SetSensorLowspeed(IN_2);
int dir;
ClearScreen ();
TextOut (32, 48, "Heading:");
while(true)
{
dir = SensorHTCompass(IN_2);
NumOut(39, 29, dir );
Wait(500);
}
}
When we run this program, and slowly rotate the bot in one direction, the
numbers printed on the screen jump around in no recognizable pattern (not
smoothly increasing or decreasing), and are not limited to compass directions
(i.e. they go over 360).
Thanks,
Karen
|
|
Message has 1 Reply: | | Re: Compass sensor with NXC
|
| (...) I emailed Karen with the solution to her problem. This can trip you up if you aren't careful. Drawing values to the screen can confuse you if you draw over the top of an existing number without clearing the screen first. John Hansen (17 years ago, 29-Feb-08, to lugnet.robotics.nxt)
|
Message is in Reply To:
| | Re: Compass sensor with NXC
|
| (...) Which compass sensor are you using, the HiTechnic one or the Mindsensors one? Are you using a low level API function to read its value or are you using one of the newer API functions specific to the compass sensor? Can you email me your (...) (17 years ago, 28-Feb-08, to lugnet.robotics.nxt)
|
5 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
|
|
|
|