03-09-2013 02:58 PM
I am trying to create a kill/limit/homing switch for a stepper motor (as seen below, I am using a cheap button for testing), but I continually get error messages (primarily error 5003) when I try to read from the pin connected to the switch. In my attempts at debugging I created a very simple vi that is supposed to light up an LED when the switch is pressed (as see below) and I received the message again. Prior to this I ran the stepper motor example to confirm that LabVIEW and the Arduino were communicating properly and also tested to make sure that I was getting a voltage across the button when it was pressed.
Any help or suggestions would be greatly appreciated,
Sam
03-10-2013 03:24 AM
Do you ever use the "Abort Execution" button to stop your VI? This often causes errors when trying to connect because the resource was never freed.
03-10-2013 08:39 PM
No, I always try to use the "Abort Execution" as a last resort and the Stop Button still works even after I get the error. I'm sure you are well familiar with these VIs and already know this, but upon my digging a little deeper into the Digital Read VI I found that the error was originally from within the ReadWrite VI (specifically the error originates from the "false" sent from the arduino Wait VI, but I think its because it no longer has any bites to read).Here is the case that ends up sending the timeout error.
I'm guessing that is why you asked about the "Abort Execution". When I hit the button all communication between the computer and the Arduino ceases. I can't regain communication until I unplug and re-plug in the USB.
After I sent the original question I rearranged the wiring, using the ground on the digital side instead (that didn't work). Then I tried using the AnalogRead VI and Analog pins, even though I don't need to read a voltage (that didn't work).
As a test I ran the test VI in my first post, didn't hit the button (hence didn't get the error), hit the stop button, and then was able to open and run the stepper example VI without having any trouble, which was expected.
03-15-2013 03:42 PM
Does this happen on every pin or just pin 2? Do you see this with any other VIs (try some examples).
The error basically means LabVIEW sent a command to the Arduino but the Arduino never responeded (the Arduino should respond to every command LV sends it).
Can you also try your simple VI with nothing attached to the arduino (other than the USB cable). Its possible something you've attached (shield, etc) is draining power causing the arduino to brown out when you make it actually do something.
Let us know and we can help you figure it out.
-Sam K
LIFA Developer
03-15-2013 10:08 PM
Hi Sam,
In the time sense my last post I did test every digital pin to check if it was just happening with pin 2, but unfortunately it continued to happen on the other pins as well. I tried disconnecting everything from the board and running not only my test vi but your sample vis too, and nothing happens (including error messages).
I did remove the shield and all other components, but kept the button, and the same error persisted. I documented what happened which you can see below.
I have only been learning how to use both labview and the arduino for a few weeks so I don't have much experience to let me know what to make off this. I have begun trying to write my own digital read vi and .ino to communicate with one another, but I am extremely novice, both at LabVIEW and Arduino programming, so it might take a while.
Thanks for your time,
Sam
03-19-2013 09:24 AM
It's hard to make out your circuit from the picture, can you post a circuit schematic (Fritzing is a free open source program for making circuit schematics).
It looks like your button is connected to power and ground. When you press the button it will short power to ground. This short circuit will pull as much current as it can through the arduino likely causeing it to brown out (hence the lights go out).
Try setting up your button like the pic on the left:
(image from: http://www.acroname.com/howto/button/button.html)
The resistor limits the current that will flow through it when you press the button. In the left image when the button is not pressed no current can flow and V'=GND. When you press the button you get a 5v drop over the resistor and V'=5V.
I hope this helps, if not please post a circuit schematic so we can have a look.
-Sam K
LIFA Developer