05-18-2023 09:52 AM
@letmetry wrote:
@Knight Of NI
Hi,
yes I have watched this but I cant find a way to apply it to my problem
Thanks
Then we need a better description of your exact problem and your actual LabVIEW code (not a picture) so we can debug it.
05-18-2023 09:57 AM
Attached is an example of what I am trying to do. However I have changed from reading a big load of strings to just sending one hex string depending on the various states
05-18-2023 10:17 AM
I did some cleaning up of your VI. The main changes are the following:
1. Replace the VISA Open with VISA Configure Serial Port. This makes sure we have the right baud rate and other settings.
2. According to the code you posted earlier, the Arduino will only send a status when it receives a command. Therefore, do the read after your write.
I also redid the decoding of the status based on what you posted earlier.
05-18-2023 10:19 AM
@letmetry wrote:
Attached is an example of what I am trying to do. However I have changed from reading a big load of strings to just sending one hex string depending on the various states
Go back and rewatch that video... Especially the first section about receiving ASCII data with a termination character.
At first glance I see a couple things here
05-18-2023 10:32 AM
The example I attached is my attempt LOL!
So the logic latch is to keep the status of each led on once the relay locks.
This prevents the need for the arduino to continually sending data as lab view was getting slow in that situation.
the command send "relay1on" the led would flash and that was it so I implemented a latch system,
Probably not the best idea for sure.
05-18-2023 10:43 AM
Just to add to the discussion, it is not necessary to use hex format for sending just a single byte. You have 6 relays, which can fit into a single byte. So you can send just a single byte as the response (you don't even need a termination character since you know you are reading exactly 1 byte).
byte status = 0b00111111;
Serial.write(status);
The labview code will look like this then:
05-18-2023 11:11 AM
@crossrulz
Thank you for this woah!
Amazing how I can ask a question and somebody can decipher what im trying to say and then give a solid answer, well done.
I am going to go over this for a bit and will get back to you when I have a better understanding of what's going on.
As for now it is working much better 🙂
Thank you !
05-26-2023 04:20 AM
@crossrulz
Thanks for the help everything works very well and now I can use your example as a foundation to build better Labview.
Is there any good places to search so I can get a better understanding of how the example you have made works ?
Regards,