i want to run an esp32 for dedicated functions. The ESP32 controlls some Relais, and buzzers, and mybe more.
I need help to implement a scripte for sending printer status values trought i2c channel to my ESP32. It is not neccessary to controll the printer over i2c. I need the communication just in one direction, values from my printer to my Esp.
I'm new in Octopi and i cant find a good solution, maybe there is a plugin i do not know/found.
I know there are differnet examples and tutorials for octopi plugin programming. Can you give me a litte help out of your Experience to have a fast start?
You should probably look at the ZChange event instead but the example on that events page shows how to configure calling a python script for an event. There are plenty of examples on using the i2c bus from python that can be found with a Google search. Should just be a matter of cut and pasting something that will work for you.
ZChange
The printer’s Z-Height has changed (new layer) through a G0 or G1 that was sent to the printer through OctoPrint (not triggered when printing from SD!)
I only print with Octopi and dont need SD Printing. I will try, and report.
You can use the following generic placeholders in your event hooks:
{__currentZ}: the current Z position of the head if known, -1 if not available
But i dont understand what i have to do.
I want to write a script which sends Z over i2c
The Script waits for an ZHeight Event (if enabled), and sends the Payload of the Event over I2C.
Sounds easy, but i need more help to get it. I have no experiences with python. Learning by Doing.
Type "raspberry pi i2c python example" into your favorite search engine in your favorite browser (leave out "python" or add your favorite programming language). Heck, add "esp32" since you said that was the device you are going to use. Start by reading at least 5 of the links in the search and then report back with your success or failure with:
Installing the I2C tools and libraries on OctoPi.
Installing the ESP32 and connecting the I2C bus to the Raspberry Pi.
Running tools like I2cdetect to find your device.
Modifying config.yaml to add the event(s) you want calling a bash script.
Write the bash script that outputs the value(s) passed to a file.
From all the examples you found with your search, extract a python program example that most closely matches what you are trying to do.