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

Moderator: igrr

User avatar
By erhardd
#50562 This is the library that i've testet:
https://github.com/thejpster/Mcp23s17
in this project:
viewtopic.php?f=29&t=6069#p31719
.. it's big, you have to search for:
#include <Mcp23s17.h>
#define MCP23S17_SLAVE_SELECT_PIN 2
MCP23S17 Mcp23s17_1 = MCP23S17(MCP23S17_SLAVE_SELECT_PIN,0x1);

Mcp23s17_1.pinMode(OUTPUT);

// Cycle the output lines at a staggered rate, pin/2 milliseconds
long timeoutInterval = 1;
long previousMillis = 0;
uint16_t counter = 0x0000;

void timeout()
{
Mcp23s17_1.port(counter++);
}

(.. it's an old project. Today I would place most in SPIFFS ..)
User avatar
By Almador
#50609 Thanks a lot erhardd, you are my saviour! ;)

You used the usual SPI.h for ESP8266, right ?

Using the expander as OUTPUT work well. Even if it is kinda strange that it does not matter which ADDR I type in.
For Example: MCP23S17(MCP23S17_SLAVE_SELECT_PIN,0x5); and my Expander is wired to be 0x00 / 0x20 - the OUTPUT will be set anyway. :lol:
However I can still use different CS_Pins if I will not be able to fix that.

Thanks a lot ;)
User avatar
By jakespotgieter
#60362
Almador wrote: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 ?



did you ever come right with this?
User avatar
By jakespotgieter
#60450
erhardd wrote:This is the library that i've testet:
https://github.com/thejpster/Mcp23s17
in this project:
viewtopic.php?f=29&t=6069#p31719
.. it's big, you have to search for:
#include <Mcp23s17.h>
#define MCP23S17_SLAVE_SELECT_PIN 2
MCP23S17 Mcp23s17_1 = MCP23S17(MCP23S17_SLAVE_SELECT_PIN,0x1);

Mcp23s17_1.pinMode(OUTPUT);

// Cycle the output lines at a staggered rate, pin/2 milliseconds
long timeoutInterval = 1;
long previousMillis = 0;
uint16_t counter = 0x0000;

void timeout()
{
Mcp23s17_1.port(counter++);
}

(.. it's an old project. Today I would place most in SPIFFS ..)



Thank you for this. Finally got it working!