sumotoy / gpio_MCP23S17

A complete library for Microchip MCP23S17(teensy,avr,arm,esp8266)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ESP8266

ofthesea-io opened this issue · comments

This is a long shot, but I will give it a go...

Does this library work on the ESP8266 chip , as stated?

Currently, I'm using the following library and it works - https://github.com/n0mjs710/MCP23S17

I swapped the two libraries, set the CS pin to15 and the HAEN to x20 (only have one MCP23S17) and used your basic example to write "high", "low" to each IO to see if it works. I put in LED's to see if the lights turn on and off, but nothing happens.

The code Im using....

`#include <SPI.h>
#include <gpio_MCP23S17.h> // import library

//define CS pin and using HAEN or not
//to use HAEN, address should be 0x20 to 0x27
gpio_MCP23S17 mcp(15,0x20);//instance (address A0,A1,A2 tied to +)

void setup(){
mcp.begin();//x.begin(1) will override automatic SPI initialization
mcp.gpioPinMode(OUTPUT);
}

void loop(){
for (int i = 0; i < 15; i++) {
mcp.gpioDigitalWrite(i, HIGH);
delay(100);
}

for (int i = 0; i < 15; i++) {
mcp.gpioDigitalWrite(i, LOW);
delay(100);
}
}`

As stated before, the wiring is setup correctly as the other library works.

Thank you

i have the same setup on a ESP8266
i can't get it to work either,
tried several CS-pins,
note that #include <SPI.h> can be commented out without error , it is included in the library .

hej,
A year later. I have the exact same situation as you do PaceMaker.
I solved it by editing the gpio_MCP23S17.h file.
Changed all max speeds to 1000000UL;
I guess the code cannot identify the unit as a esp8266 automatically, and the frequency is set too high.

Also one note, it should be i < 16, otherwize the last LED does not light up.

You also need to execute the yield(); function every once in a while or else SPI overload will reset your ESP8266.