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

Moderator: igrr

User avatar
By Almador
#50461 Hello there,
I can't manage to use a MCP23S17 Port Expander with my ESp8266-12F which I program trough the Arduino IDE. I tried to reach the Expander by using the gpio_MCP23S17.h lib but couldn't make it work.

My circuit looks like that:
Image
At GPA0 of the expander is a LED as well.

Code: Select all#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <SPI.h>
#include <gpio_MCP23S17.h>

gpio_MCP23S17 expanderTwo(5, 0x21);         

void setup()
{
   expanderTwo.begin();
   expanderTwo.gpioPinMode(OUTPUT);
}

void loop()
{            
   expanderTwo.gpioDigitalWrite(0, HIGH);
   expanderTwo.gpioDigitalWrite(8, HIGH);
   delay(500);
   expanderTwo.gpioDigitalWrite(0, LOW);
   expanderTwo.gpioDigitalWrite(8, LOW);
   delay(500);
}


Time is running out and I have know Idea how to make it work neither I have found something helpfull on the web. Please help me :oops:
I'm quite a newbie at this stuff and also not very good in Englisch, so I would ask for your indulgence.

Thanks
Alex
User avatar
By Almador
#50472 Do you mean this lines ?

Code: Select all#if defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MKL26Z64__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
   gpio_MCP23S17(const uint8_t csPin,const uint8_t haenAdrs,const uint8_t mosi_pin=11,const uint8_t sclk_pin=13,const uint8_t miso_pin=12);//any pin,0x20....0x27
   void          postSetup(const uint8_t csPin,const uint8_t haenAdrs,const uint8_t mosi_pin=11,const uint8_t sclk_pin=13,const uint8_t miso_pin=12);//used with other libraries only
   #else


by mosi_pin=11 is the GPIO11 ment not the actual Pin11 of the ESP, right ?