I've been having fun playing with an Ethernet shield (W5500), and it's working beautiful with talking back and forth with SPI.h & Ethernet.h (client write & read).
Is there not the same thing for the ESP8266 or ESP32? Everything I keep on reading, you need to have a slave on the arudino and master on ESP, then have separate handshake lines... Why is it so different then Ethernet shield?
Not sure what you mean.
An ESP-based Arduino (e.g. WeMos D1) could replace an Arduino with W5500 shield.
There are some limitations. Only one A/D input, and a limited number of (3.3volt) I/O pins.
Leo..
All the ESP8266 shields that I've seen just use the serial connections to communicate between processors. The Arduino uses the AT command set to control the ESP. Is yours different?
I have a few boards, ESP8266 from adafruit, and some ESP32 from China. They work with SPI & I2C.
The Ethernet.h makes reading and writing to an Ethernet device very simple, using the standard 4 pins of SPI.
With the ESP, I can't seem to find a good library that allows the same eas. Most talk about turning the arduino into a slave with interrupts and more pins for handshaking. Not nice and clean like with an ethernet shield.
Might drop the arduino frontend on the ESP and try getting into the ESP-IDF coding. Still searching for better SPI communication examples between arduino and ESP
The ESP8266 has libraries for WiFi, web server, etc. Honestly I don't know how an ethernet shield works as I never used it but it's hard to believe it gets cleaner than how I use the network on my ESP8266 devices. A few lines of code to connect to the WiFi, then a line to create a network client and start talking to web sites. The MySQL connector is just as easy to use.
The ESP32 (which has more IO than an Uno or Micro) will be much the same. I have one but never used it. Using the ESP32 as WiFi "shield" would be a terrible under use of this processor.
Also most Arduino libraries will work unchanged on the ESP8266 (maybe also on the ESP32?), or with minor changes such as adding a yield() here and there, and making sure you use the correct pins for SPI/I2C. That should be about it to use your existing libraries to talk to your Ethernet device (whatever that may be).
Ah sorry, I must not be explaining myself that well.
The arduino takes in data from a bunch of sources, ethernet, can, i2c and a few serial ports. It manipulates that data and currently sends it to ESP (via a serial port), which the ESP turns on the access point that allows tablets to connect and display the data via MQTT. The tablets also can send commands back to the arduino via ESP. It's all working fine, I just wanted to play around with SPI between the arduino and ESP.
I haven't found a good library/code that runs on the ESP that can handle SPI communication back and forth to arduino.
The ESP8266 totally supports SPI - I'm using that to communicate with an SD card reader. But that's of course in master mode, I never tried slave mode, though it should work.
Does your module have the appropriate ports broken out?
It's software based so in principle you can use any set of four pins to do SPI but you at least need four pins broken out.