Hey guys, just wanted to give a quick update to my findings with trying to get the ESP-NOW protocol working with OpenPLC. So, after having some initial issues and a few odd things happening that I still don't completely understand, I was able to send some data between two of my ESP32 boards via ladder logic in conjunction with Arduino code extensions. I'll attach the projects below so you can check them out as you wish. My code is quite ugly, due to having to copy and paste a lot of it to get the result I wanted, but in the end it works and I have a framework now to work with for boolean, float, string and integer values!
For the project files, please note the following:
In the SENDER Arduino code, be sure to put the MAC address of the RECIEVER unit. Otherwise it will not work.
The SENDER ladder logic is made assuming you have a button wired up to %IX0.6. On my breadboard, I also have a pulldown resistor on this pin as well to eliminate false triggers. Without it, you will likely have erratic triggers and all sorts of similar annoyances.
In the Transfer window, my digital outputs are set to : 01, 02, 03, 04, 05, 12, 13, 14, 15, 16. I set it like this for all of my projects because I end up with odd mapping if I don't. I happened after an update a while back, but it was an easy fix and made sense to me so I didn't mention it anywhere until now. Plus, that same update was what got the debug feature working like it is supposed to for ESP32!
What should happen is that you power both units, after transferring the corresponding programs, and then when you press the button you wired up on the sender device, the sender's on board LED should light up, then almost immediately the on board LED on the receiver device should light up as well.
You can also see the other data being sent through the serial monitor on the Arduino IDE if you connect one of the boards to that and pull it up. It's pretty cool!
For now, I haven't done much testing beyond what you see here, but in its most basic form, it seems to work, but most definitely could be improved. If you have any suggestions for improvements, feel free to edit anything and post it here, I'd love to see what people come up with. I'm by no means good with C++ but I can see the potential for this protocol for OpenPLC and really want to get them working well together!
Happy programming!
-Andy