1

So I need to control a RPi from a separate PC running Labview, and serial is the only way I've managed to get any communication working at all (why can't they just implement SSH...).

I've got my python (2.7) program on the raspberry reading the inputs properly, but how can I send a function with parameters through for it to carry out? Each line comes through as a variable called serial_in which isn't callable.

James
  • 15
  • 4
  • 1
    The RPi does implement SSH. You just need to plug it into the network and SSH to the IP address of the RPi. There's a default login and password. – jcoffland Sep 17 '15 at 10:45
  • Yeah I SSH with the Pi all the time, it's Labview that's the problem! – James Sep 17 '15 at 11:16

1 Answers1

1

You could serialize the function as a string, send it over the serial port and then use eval() on the RPi to execute the code. If the function is simple you could just form it as a string to begin with. For example, you could send a function like this:

send("x * x")

Then on the RPi side:

func = receive()
result = eval(func, {x: 1})
jcoffland
  • 5,238
  • 38
  • 43