-->
Page 1 of 3

Cannot use MCP23S17 (SPI I/O-Expander) with ESP8266-12F

PostPosted: Sat Jul 09, 2016 11:22 am
by Almador
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

Re: Cannot use MCP23S17 (SPI I/O-Expander) with ESP8266-12F

PostPosted: Sat Jul 09, 2016 11:58 am
by martinayotte
I don't see any errors here. So, it should work !
Did you double check that your wiring is identical to your schematic ?
Did you have tried the example from https://github.com/sumotoy/gpio_MCP23S1 ... xample.ino ?

Re: Cannot use MCP23S17 (SPI I/O-Expander) with ESP8266-12F

PostPosted: Sat Jul 09, 2016 2:19 pm
by erhardd
You have to take the right pins! See gpio_MCP23S17.h.

Re: Cannot use MCP23S17 (SPI I/O-Expander) with ESP8266-12F

PostPosted: Sat Jul 09, 2016 2:30 pm
by Almador
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 ?