LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Limit switch to reverse motor movement problem

Hi guys, recently i am trying to create a robot that uses RF controller, arduino and labview. The issue i facing now is i am unable to trigger my limit switch to make my motor movement reverse when it hits on it. For normal motor trigger from lab view, it is working perfectly. But when comes to limit switch, it has no response. The following files is my VI and arduino coding. For the arduino coding, lets just focus on case '1' since the triggering is not yet complete. The motor i use is only a normal DC motor without encoder and connected to a L298 board. Is it my VI problem?

0 Kudos
Message 1 of 14
(4,753 Views)

1.  There is no need to set the size of the serial port I/O buffer every iteration of the while loop.

2.  Where do you actually read the limit switches and where do you actually control the motor?

0 Kudos
Message 2 of 14
(4,748 Views)

1. Basically, i just remove it?
2. The limit switch is wired like a (pull up resistor concept) and connected to other digital port in arduino. It sends signal into interupt the motor movement.

//

case '1': //if the controller type f
{

Serial.println("forward");
if (switch1 == HIGH)
{
digitalWrite(en1,HIGH);
digitalWrite(en2,HIGH);
digitalWrite(en1o2,HIGH);
digitalWrite(en2o2,HIGH);

digitalWrite(in1,LOW);
digitalWrite(in2,HIGH);
digitalWrite(in3,LOW);
digitalWrite(in4,LOW);
digitalWrite(in1o2,LOW);
digitalWrite(in2o2,LOW);
digitalWrite(in3o2,LOW);
digitalWrite(in4o2,LOW);
//delay (500);
}
//


3. The motor is control via wireless; controlled from labview which i assign the key 1,2,3,4

0 Kudos
Message 3 of 14
(4,744 Views)

1.  Yes.

2.  What does any of that have to do with LabVIEW or the VI that you showed?

0 Kudos
Message 4 of 14
(4,741 Views)

My limit switch not functioning when running on labview, it works just fine if using hyper terminal 😕

0 Kudos
Message 5 of 14
(4,739 Views)

But your LabVIEW doesn't show anything about limit switches.  The only think I see is it trying to read a joystick.

0 Kudos
Message 6 of 14
(4,733 Views)

im sorry, the limit switch is a hardware connected to arduino.

0 Kudos
Message 7 of 14
(4,727 Views)

And where does LabVIEW find out from the arduino tha the limit switch was triggered?

 

So far, you still haven't shown now this is a LabVIEW problem.

0 Kudos
Message 8 of 14
(4,723 Views)

so i need to add something into labview that to let it knows there were limit switch in used. Mind to hint me which to add in the labview? Thx!

0 Kudos
Message 9 of 14
(4,719 Views)

You need code in your Arduino to report back when a limit switch has been triggered.  Then have LabVIEW read that as part of the VISA read.

 

You need to work out your entire scheme about what the Arudino's role is, what LabVIEW's role is, and how they are to communicate with each other before you start worrying about programming LabVIEW.

0 Kudos
Message 10 of 14
(4,712 Views)