|Using new NXT sensors from Lego?
|Page 1 of 1|
|Author:||ruthmackie [ Tue Nov 20, 2007 4:36 am ]|
|Post subject:||Using new NXT sensors from Lego?|
I've just started using RobotC (only downloaded it yesterday!). Today I ordered the 3 new sensors for the NXT from the Lego online shop - Colour sensor, Compass sensor and Accelerometer. Do I need an update for RobotC to use these sensors in my programs, or do they use existing drivers (i.e. are they made for Lego by HiTechnic or Mindsensors, for example?)
Alternatively, can I just poll any generic sensor, including homebrew and just establish the input range of the sensor empirically?
|Author:||elemes [ Tue Nov 20, 2007 6:39 am ]|
In my best knowledge Lego sells Hitechnic's sensors. You may want to check individual sensor pages on http://www.hitechnic.com for coding examples.
RobotC 1.10 distribution contains also more examples on on how to use hitechnic sensors. Loop up the samples in the installation directory which is by default:
C:\Program Files\Robotics Academy\ROBOTC for Mindstorms\Sample Programs\NXT
and check the following examples:
Nxt Hitechnic Accelerometer.c
Compass Sensor Driver.c
I2C Coding Examples.c
You may also want to see (almost) on-line the results (on the PC screen): just include some lines from the NXT DebugStream Test.c program but use writeDebugStream function instead of debugPrintLine. The latter would simply add a CR/LF at the end of the string before printing but there seems to be a minor compiler bug here.
|Author:||ruthmackie [ Tue Nov 20, 2007 6:44 am ]|
Thanks for that information. I should have worked my way through the examples before asking! Much appreciated.
|Author:||elemes [ Tue Nov 20, 2007 7:32 am ]|
|Post subject:||Re: accelerometer|
Never mind. I'm also a newbie with RobotC, installed the trial a week ago and asking couple of questions.
I have bougth gyroscopic and accelerometer sensors directly from hitechnic and made some measurents with them. They seem to be working fine, I need just a few more days to get familiar with them.
If you do not know much about on accelerometers you can find loads of information on them on the internet (use "inertial sensor" as search key), e.g.
http://www.eecs.berkeley.edu/~boser/pub ... slides.pdf
There is a tiny (microgramm-size) mass within the sensor, "hanging" on (piezoelectric) springs. When sensor housing is moved the mass follows it with a little delay. The change in the masses position results in changed capacity and measured as acceleration.
Be careful: mechanical shocks -- like dropping sensor the onto a hard surface -- might break the micromechanical circuit within the sensor while a similar drop of a light sensor will not yet harm the electronics. I usually work with these sensors over a carpet, you know, just in case.
|Author:||starwarslegokid [ Tue Nov 20, 2007 9:25 pm ]|
Elemes is dead on, the code examples that come with RobotC should work great for the sensors you bough. You can also use the sensors like a sonar sensor, in sonar centimeters mode.
The sample code uses the sensors in I2C mode, the only really important difference would be that I2C mode gives you more control over the sensor and allows multiple sensors on 1 port. Using the senor in sonar mode is much more convenient and easy to use however.
Good luck with your new sensors, I'm jealous! lol B-)
|Author:||ruthmackie [ Mon Nov 26, 2007 5:16 pm ]|
Thanks, everyone, for the helpful replies. Now I just have to wait for the postman
|Page 1 of 1||All times are UTC - 5 hours [ DST ]|
|Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group