0

Let's say I have a few sensors and LEDs connected to a raspberry Pi and I want to make a fully connected GUI on a desktop(PyQT) for it. So I can see the sensor values, toggle the LEDs and so forth.

What is the most optimal way of doing this?

  • 2
    how do you define optimal? ...... you have provided zero details about the configuration of your system, so the question that you asked is un-answerable – jsotola Mar 22 '18 at 19:25
  • assuming both machines are on the network, a simple client/server method would be pretty easy to pass data back and forth – Chad G Mar 22 '18 at 20:33
  • Sorry for not being clear enough @jsotola. I am just starting out. I didn't explain much about the configuration of the system as I am building it as I go. RIght now there are not even any hardware connected to the GPIO. I was just looking for topics to learn from. – Samiul Hoque Mar 23 '18 at 22:57
  • Thanks alot @ChadG. Took your advice and got the data passing part working. Working on the rest now. – Samiul Hoque Mar 23 '18 at 22:57
  • @scitronboy I found out about PyQT. Looking into it now. Hopefully I can make it work soon. – Samiul Hoque Mar 23 '18 at 22:58
1

So here was my findings after tinkering around with it all day. Seems I just got the communication part down. Still need to figure out the GPIO end and the client GUI end.

I wrote a simple server/client code using sockets.

server end code:

import socket
s = socket.socket()
host = '192.168.0.103'   //IP from the router
port = 12345
s.bind((host,port))

s.listen(5)
while True:
    c, addr = s.accept()
    print ('Got connection from' , addr)
    c.send( 'Response from Orange Pi' )
    c.close()

Client end code:

import socket

s = socket.socket()
host = '192.168.0.103'   //IP from the router
port = 12345
s.connect((host,port))
print(s.recv(1024))
s.close()

I am fairly new to python so I am still digging around to make the GUI for the client end. Will post updates as I progress.

Not the answer you're looking for? Browse other questions tagged or ask your own question.