Emil
Emil

Reputation: 47

Executing simple terminal commands through Wifi on raspberry pi using QT creator

I'm attempting to write a program for a school project, where I need to make an interface on a linux-based platform, in which I can click a button, that'll then run a set of commands on a raspberry pi connected via wifi.

The RPI is connected via SSH and the wifi network is one created from my own router on which both the PC and the raspberry are the only ones connected. I've given the RPI a static IP adress, so connecting to it outside of QT isn't an issue.

My issue is, that I'm having trouble finding a way to execute even a single command on the RPI using a button in QT.

Upvotes: 0

Views: 650

Answers (1)

neuhaus
neuhaus

Reputation: 4104

Use system() to execute a command inside the button's callback function.

Example:

system("ssh raspi \"/bin/echo hello world > file.txt\"");

Upvotes: 2

Related Questions