View Full Version : Lego Programming?!
JamieSimonson
01-02-2011, 18:20
I was wondering if the lego :] touch sensor could be programmed using C++ (windriver) or does it only work using the NXT brick and that sort of programming. Can you Help?
EthanMiller
01-02-2011, 18:23
{As an FTC programmer, I can tell you that the closest to C++ and Windriver you'll get with the NXT is RobotC. If you have an FTC team in the area, they have a license. There's also a 30 day trial, if you want to test it.
I am unaware if there is a way for FRC teams to get it free/cheap without an FTC team to lend it, though.}
EDIT: Wow, misread/misunderstood the question. I'm going to go away now, until I can test it out.
EDIT 2: Looks like a couple of things. The default output appears to be I2C using the cables provided. So, if you can figure that out, you can probably get the cRIO talking that way. DIO would be your friend. Alternatively, you can crack the thing open, and solder on two wire leads, then close it again. How To Do It (http://www.instructables.com/id/Simple-interfacing-Lego-Mindstorms-NXT-to-Arduino-/). Then it should be usable for both.
Of course, if you go through the trouble of opening it, you may as well just use a momentary pushbutton, unless the enclosure is important.
RoboDesigners
01-02-2011, 18:28
A touch sensor should just be a digital signal: 1 or 0. Treat it just like any other touch sensor.
EDIT: Is the sensor connected to the NXT, or to another controller?
WizenedEE
02-02-2011, 02:18
There is a port for LEGO sensors on the digital sidecar. We program in labview, but it should be easy enough to use it.
Joe Ross
02-02-2011, 09:54
There is a port for LEGO sensors on the digital sidecar. We program in labview, but it should be easy enough to use it.
The NXT port on the digital sidecar is for I2C NXT sensors. The touch sensor is simply a switch and so should be connected to the digital IO, just like any other switch. Making an interface cable might be a pain.
Connect pin 1 of the touch sensor to the signal pin of the DIO and pin 2 of the touch sensor to ground, and you're set.
basicxman
02-02-2011, 10:17
Based on prior FTC and LEGO experience with these sensors, I would highly recommend buying a cheap microswitch. It would probably be easier to mount, and would definitely be easier to interface.
What is the application for this touch sensor?
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.