Right now im trying to make it work on RobotC. I know that this subforum is about coding on Labview but i can't find an answer for my problem =/
I'm working on a project and i really need some help to understand how lego-temp.h works. I want to make a while loop so i can measure the temperature while the robot is moving. The loop will stop when i'll find a temperature higher than the temperature that i have before the robot started moving.
I found out that i can read a temperature with that command --> LEGOTMPreadTemp(S2,temp);
This command is reading from the sensor 2 , my temperature sensor, and writes the result on a variable called temp.
My problem is that i can't find how can i read the temperature while the robot is moving.U can find the lego-temp.h on \Sample Programs\NXT\3rd Party Driver Library\include but i will post it as a link if u can't find it.
Thanks for ur time 😄
Solved! Go to Solution.
While I am not familiar with RobotC I think it might be helpful to see more code. If you are able to get temp readings using the code you posted then that might not be the problem. My guess would be that in the greater context of the project, when the robot is moving it doesn't get to the temperature reading part of the code.
Thank u for your reply!
Well i tried one more time to create the code on lego mindstorms ev3. The problem that i can't measure while the robot is moving is still there. I figured another way to make it kinda work. I programmed the robot to to make small moves just to find a candle.
I'll post what i did with some screenshots.
Some guy on a forum advised me to create a code with 2 start blocks but i couldn't make it work.
You need to set two while loops in parallel.
Meaning they don't have wires connected except for initializing and after the while where they can come together to close.
All loops that are not via via connected run in parallel.
This is in fact LabVIEW with a Mindstorm shell, so the same parallelism applies.
I don't have an EV3 but an older version, less capable and at the moment no software loaded but I can guarantee that what you want is possible.
I don't have EV3 either. I'm working on NXT but i had a problem setting up the temperature sensor block on mindstorms NXT so i used the EV3 program. About the two while loops what should run inside them. When i tried to code with two starts and two while loops i had on the first the movement blocks and on the other the switch statements (ultrasonic,touch and temperature).