NI Home > Community > NI Discussion Forums

LabVIEW for LEGO MINDSTORMS and LabVIEW for Education

Reply
Member
Haneetha
Posts: 8
0 Kudos
Accepted Solution

Read Rotation Sensor

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? 

Member
Tori.M
Posts: 140
0 Kudos

Re: Read Rotation Sensor

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:

Snippet.png

 

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

 

Kind regards,

Tori
Student