04-28-2014 07:03 PM
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?
04-28-2014 07:08 PM
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?
04-28-2014 07:15 PM
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
04-28-2014 07:17 PM
1. Yes.
2. What does any of that have to do with LabVIEW or the VI that you showed?
04-28-2014 07:19 PM
My limit switch not functioning when running on labview, it works just fine if using hyper terminal 😕
04-28-2014 07:38 PM
But your LabVIEW doesn't show anything about limit switches. The only think I see is it trying to read a joystick.
04-28-2014 07:54 PM
im sorry, the limit switch is a hardware connected to arduino.
04-28-2014 07:57 PM
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.
04-28-2014 08:07 PM
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!
04-28-2014 08:27 PM
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.