Macro: Execute python script on Rpi
-
Hey!
I'd like to be able to execute a python script on an Rpi. The Rpi is not connected to the duet board.
Any ideas?
-
This is how I have done it:
- Connect any unused Output of the Duet with one of the GPIOs of your Pi alongside with a GND connection (optionally use a opto-coupler for the GPIO connection for power isolation).
- Use a Macro on the Duet using the M42 command to switch the pin on the Duet-side high/low.
- Watch the GPIO-pin from within your python script for change.
-
In case you cannot physically connect the Rpi to the Duet for whatever reason you could use something like this https://coptonix.com/products/lan-i2c-adapter-ms/
and send a I2C-request from the Duet to the Pi via Ethernet. -
Thanks for the replys!
I'd really like it to be completly wireless.
Does the Macro-functionality support API-calls or anything like that? Or is it just g-code?
-
As far as I am aware, it can only do G-Code since it's basically just a list of G-Code commands executed in sequence.
Two more ideas which, however, are probably still not exactly what you are looking for:
-
Use a minimal Microcontroller powered off the Duet like an Arduino or even better a Bare Microcontroller with a WiFi Shield or something like that to monitor a Level-change on some pin and send out a notification to your Pi
-
Use a Serial/UART to WiFi Bridge and read the serial data from the Duet using the Pi.
Let me know if you find some other solution to your question, I'd be very interested in hearing about it..!
-
-
depending on what board and version you are running, you can do it with this handy extension:
https://forum.duet3d.com/topic/13194/dsf-extension-exec-on-mcode-was-shutdown-sbc