04-02-2024 03:39 AM
Hi everyone. I want to blink an LED using arduino and labview. the problem is that the labview don't send command on serial monitor in arduino until Highlight Execution botton pressed. can anyone help me
04-02-2024 03:47 AM - edited 04-02-2024 03:48 AM
Hi mgajh,
@mgajh wrote:
the problem is that the labview don't send command on serial monitor in arduino until Highlight Execution botton pressed.
How do you know your VI does not send anything to the serial port? Do you get any errors in your VI?
Cleanup your VI:
General suggestion: don't use the same serial port with two programs in parallel.
04-02-2024 08:56 AM
Since you're since some million commands/sec i'd guess the Duty cycle resets each time causing the LED to never change.
04-02-2024 10:57 AM
@mgajh wrote:
the problem is that the labview don't send command on serial monitor in arduino until Highlight Execution botton pressed. can anyone help me
If it only works in Highlight Execution, then you have a race condition. In this case, I fully agree with the others that you just need to add a wait in your loop to limit how quickly you are sending messages to your Arduino.
The other option would be to have your Arduino echo whatever it read back to the PC. This would help the debugging process as you will have a clue that it read what you wanted it to and it will limit the loop rate as VISA waits for the response.
04-03-2024 07:57 AM
First of all, I want to thank you for your good and useful explanations. In the beginning you mentioned how you found out that the lip view was not sending the command. I tried the code with arduino serial monitor and it sent the command without any delay or problem. All the connection items such as port and... are correct for LabView. Using format into string, I managed to send the command without Highlight Execution, but there are still two problems:
First: the command is sent with a delay
Second: After a few seconds, the system exits its normal process and returns to the first state
Putting a timer with different values didn't help either
04-03-2024 07:59 AM
Thanks for your response. putting timer with different values doesn't help. Can you elaborate on your second suggestion?
04-03-2024 09:01 AM - edited 04-03-2024 09:01 AM
04-03-2024 11:54 AM
@mgajh wrote:
Can you elaborate on your second suggestion?
Write your Arduino so that when it receives a message, it sends that exact message back to the PC. On the LabVIEW side, you do your write and then start to read it back. When the read succeeds, you know that the Arduino received your message and what the message was. When your Arduino gets back to trying to read the port, another message will have already come in, but the LabVIEW code will be waiting for that return message. With this setup, the Arduino is what is limiting the loop rate of everything.
04-14-2024 01:57 PM
Hello I'm doing the same thing almost, well want to, but I have 3 LED's connected in arduino and I want to program in the way that through labview the led's would turn by random, let's say if I press one button the first led turns on if I press 2nd button the 2nd led turns on without turning the 1st off, and like 3rd button would turn off only 2nd LED. Where do I start? Maybe someone has a similar thing?