Joel77364
Posts: 1
Joined: Tue Feb 12, 2019 11:55 am

How to control Raspberry Pi's GPIO pins from separate PC

Thu Feb 28, 2019 7:44 am

In my application I want to turn on certain GPIO pins that are on the Raspberry Pi from my PC's C++ script. My PC is currently running on Windows 10 and my Raspberry Pi on Raspbian.

The general idea I had was to write python scripts on the Raspberry Pi itself and run them somehow from my PC when needed. Although, I am not sure how to do this or if it's possible in C++.

I know I can ssh into my Raspberry Pi and run scripts manually but the idea of this application is automation. I am able to connect my PC to the Raspberry Pi either by Ethernet or USB cables.

I have seen USB to GPIO modules that would probably work better although for now I am stuck with my Raspberry Pi.

Any knowledge or resources on how to do this is greatly appreciated.

[
Last edited by Joel77364 on Fri Mar 01, 2019 6:48 am, edited 1 time in total.

User avatar
DougieLawson
Posts: 41754
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How to control Raspberry Pi's GPIO pins from separate PC

Thu Feb 28, 2019 9:43 am

pigpiod and the matching python pigpio can do this.
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on Twitter/LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

User avatar
neilgl
Posts: 3576
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near The National Museum of Computing

Re: How to control Raspberry Pi's GPIO pins from separate PC

Thu Feb 28, 2019 12:58 pm

Maybe you could have a python script on the pi to listen for and act on mqtt messages (topics) e.g. "turn on GPIO 17"
You can send those messages from your PC in C++, or type them into a Command Prompt for testing

Return to “Troubleshooting”