LabVIEW for LEGO MINDSTORMS and LabVIEW for Education

Showing results for 
Search instead for 
Did you mean: 

Read Rotation Sensor

Go to solution

I want to measure the rotation made by port A and port B on the following example. What to know whether its going X or Y or -X or - Y against time. Also I want to measure total rotation made by the motor to calculate the distance. I want robot to write these measurements in its memory.


The port A and B are for the motors. This is not my actual program. I developed a code to solve a maze. My actual program has a start and end condition. I want the read  rotation sensor to take readings until the end of the exploration. I don’t know how to link the rotation sensor to my program. If you can please tell me where the rotation sensor goes in the mail look? And also does this rotation sensor need any loop? 

0 Kudos
Message 1 of 2
Accepted by topic author Haneetha

Hi Haneetha,


Thanks for posting on a more appropriate message board.


It may help if you were to explain the overall objectives of your code, i.e. what are you wanting to do with it?


From what I gather you move Ports A&B for your motors forward and if the distance is more or less than 20, you turn by a certail angle & send a message to the computer.


Then within your other while loop, you're trying to read the rotation of port A or port B, yet this loop will run continuously & not receive a value from the Drive Distance VI.


I've adapted the code to give you a better idea of how your VIs should be used:



Please give this a go and let me know how you get along!


Kind regards,

0 Kudos
Message 2 of 2