First Compass Program

It's not much to look at, but it allowed me to give the sensor an initial test. I verified its results with the compass in my truck! The sensor I am using is an official production line sensor from HiTechnic... it functions exactly as yours will. For now, I do not have the NXT-G COMPASS block yet (but it's coming!) so the workaround is to configure it using the Ultrasonic sensor (pick a port) set to Centimeters. Using the output data plug, I feed that number into a MATH block. You must do this because the value returned by the sensor will be between 0 and 179 degrees. I use the MATH block to multiply the value by 2 and then convert that number to Text... I then feed the text into the DISPLAY block so I can watch the number as I rotate my bot around.

I'm going to play with it some more and build a little more complex routine - will post soon.


Anonymous said…
Cool blog and I love the idea's.
Do you know how to increase the power of the motor past 100?
Anonymous said…
The only way I could find out how to increase the speed of the motors is through gearing.
Im pretty sure you cant increase it past 100 (at least in NXT-G, dont know about anything else).
Brian Davis said…
100 is the maximum power you can command the motor to. All motors have some maximum power, and at a NXT-G setting of 100 the NXT will try to drive the motor with every amp & volt it legally can.

If you need more speed or more torque (power), try gearing the motor output to run slower (and thus with more power, or torque), or gear it to run faster (but with consequently less force... there ain't no such thing as a free lunch).

Brian "at BrickFest sleep is for the weak" Davis
Anonymous said…
Hya Jim! It's David from Boston. I emailed you last week about my Catchaser robot :)

Thanks for posting the snapshot of the program but I have a question. When you set the ultrasonci sensor to centimeters what did you do with the greater/less than thing?

To the whole team: great blog! I check it every day. And in case you haven't seen it, they posted a whole bunch of info on the RIF on the site. Are you goign to join it?

Hey, David... yes, I remember you. Hope your CatChaser survived the attack! :) Remember: Dogs run, Cats attack.

As for your question - the greater than- less than drop-down box has no effect. You just leave it alone. The value the Ultrasonic sensor block receives from the Compass sensor is output from the Data Hub... you can see that I've dropped a data line out of it and into a MATH block (to multiply by 2)... I then take that value and it becomes output into the Number-to-Text block... and on and on...

As for the RIF... I hadn't looked in on the blog for a few days, but I just took a look... definitely some good info in there. I haven't decided if I'll sign up yet - need more info! (Here me, Poe - more info!)

Send me a picture of your CatChaser when you can...


Popular Posts