LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can connect to plink from System Exec but can't send the next command

Sorry for the late reply... I don't a chance to visit the forums as often as I would like.

 

You are on the right track.  The last message you posted is very close.  You simply need to open the session by logging in.  I am sure I must have posted a code example somewhere in the forum with just a basic send & receive debug interface.  

 

Let's focus on what you have.  Add a VISA Read function after you write.  At the beginning, just try sending a '\n' (carriage return) to see if it responds.  It should respond the same way as if you had a Putty session and simply hit the return button on the keyboard.  That should give you the prompts to login.  

 

There are multiple approaches to coding the full solution.  You could have an open VISA followed by a loop with the login portion of code which writes and reads to the already opened VISA session with the appropriate login & password info.  Reading will capture what is going on.  As a matter of fact, you could implement a small debug solution which consists of an open VISA session, followed by a While Loop with an Event Structure.  Add a Write button (and Read?) and a Stop button.  Add event cases for the Write and the Stop, also the Read in case you simply want to read the contents without having to send anything (although it is probably not necessary).  

 

From the Stop event case, wire the Stop (TRUE) boolean to the stop of the While Loop.  

 

Inside the Write event case, Use the Visa Write function and the Visa Read function to send the command.  Make sure you append a '\n' at the end of your command, otherwise, it may not work.  You can put a small wait time between the write and the Read function.  Sending a command will usually always send something back, so you want to read it.  Wire a string control the the Write function and a string indicator to the Read function.  

 

The small code should allow you to debug the implementation for your application.  Unfortunately, I do not have LabVIEW installed on my PC, so I could not create the small app for you.  It should be straight forward.

0 Kudos
Message 11 of 14
(1,531 Views)

Hey Ray,

 

I'm really new to LabView, and I've been trying to control the Raspberry Pi from LabView using the SSH connection.

I have already built a connection using PuTTy before, but reading through this forum I realized that PuTTy and Plink may not be the best solution for this.

So, I basically tried to go from the last image the question asker posted, but I'm just frankly not sure what the whole "export DISPLAY =:0 && DISPLAY=:0 xpdf /home/pi/sample-pick.pdf -fullscreen" is about which goes into the Visa write function's "write buffer" port. 

First of all, I don't know what this pdf file is, and I feel like he's trying to open a screen that shows the usual Pi terminal screen on PuTTY, but I just don't get the idea how like a pdf file can be used in this case. Also, if so, where can I find this file?

0 Kudos
Message 12 of 14
(904 Views)

I think the plink documentation tells you how to send several commands at once, either via batch file or in a single command line.  There's lots of stuff you can do, such as ignore responses and stuff.  You can also open a session and have subsequent sessions use that same session, but that's a bit more complicated.

 

You should be able to log in, execute a bunch of commands and log out with one plink command.  Responses will be captured in std out.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 13 of 14
(892 Views)

This could also probably be done using Pipes.

 

https://forums.ni.com/t5/Community-Documents/LV-Process-Windows-pipes-LabVIEW/ta-p/3497836

 

It allows for reading and writing standard in and out data to a terminal.

0 Kudos
Message 14 of 14
(884 Views)