Chat here is you are connecting ESP-xx type modules to existing AVR based Arduino

Moderator: igrr

User avatar
By erhardd
#50473 pinMode(SCK, SPECIAL); ///< GPIO14
pinMode(MISO, SPECIAL); ///< GPIO12
pinMode(MOSI, SPECIAL); ///< GPIO13

You are right. In gpio_MCP23S17.h is the configuration for arduino.
You must take the Spi.h for ESP8266 in:
C:\Users\ich\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\SPI
Change the wiring in your schematic. You have the mcp23s17 wired to the intern Flash-chip ..
User avatar
By Almador
#50533 Thanks for your help so far.
Unfortunately it is still not working. :cry:

The expander itself is okay, I can reach it now at 0x20 usting the gpio_MCP23S17.h lib from my Arduino Uno.
The SPI.h at C:\Users\Alex\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.5-947-g39819f0\libraries\SPI
should be the right one. The first line in comment is "SPI.h - SPI library for esp8266".

I changed the wiring to this:
Image
Code: Select all#include <Arduino.h>
#include <SPI.h>
#include <gpio_MCP23S17.h>

gpio_MCP23S17 expanderTwo(5, 0x20);            

// ----------------------------------------------Setup--------------------------------------------- //
void setup()
{
   pinMode(SCK, SPECIAL); ///< GPIO14
   pinMode(MISO, SPECIAL); ///< GPIO12
   pinMode(MOSI, SPECIAL); ///< GPIO13 -

   expanderTwo.begin();
   expanderTwo.gpioPinMode(OUTPUT);
}
// ----------------------------------------------Loop---------------------------------------------- //
void loop()
{
  for (int i = 0; i < 15; i++) {
     expanderTwo.gpioDigitalWrite(i, HIGH);
     delay(10);
  }
   delay(500);
  for (int i = 0; i < 15; i++) {
     expanderTwo.gpioDigitalWrite(i, LOW);
     delay(10);
  }
   delay(500);   
}

Maybe if have misunderstood something.
However there must be still something wrong and I do not know what else to try.