I wonder if I can use SPI to communicate between ESP-1 ESP8266 module and SPI sensors and other slaves.
If so, do I need to install a library?
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It only takes a minute to sign up.Sign up to join this community
ESP-01 was designed as WiFi network adapter, not as a controller board. The are 4 pins on esp-01. RX (io 3), TX (io 1), io 0 and io 2.
SPI requires 3 pins: clock, MISO, MOSI plus one pin for every device connected to the bus. So you could in theory use one SPI device on this 4 pins. The esp8266 Arduino SPI library works only with hardware SPI on esp8266 pins io 12, 13, 14 so you would have to use some software SPI implementation for esp8266.
To connect sensors, actuators or display to the esp-01, I2C is a feasible option. It requires only two digital pins and the esp8266 Arduino Wire library can work on any pair of io pins.
To use esp8266 as MCU with Arduino, there are many development boards with all usable pins broken out (9 pins) and USB chip for simple connection to computer and flashing (Wemos, NodeMCU). Or you can use an esp8266 module with more or all pins of the esp8266 (esp-07, esp-12).