- Wed Sep 09, 2015 4:10 pm
#28746
Samighi11 wrote:johntech2014 wrote:
A friend of mine has let me borrow a Sparkfun ESP8266 WiFi shield that looks like it has about 8 I/O pins on it which I haven't tried yet. I just got the Adafruit sketch to run on the 01 with the help from martinayotte. I only use pins 0 and 2. I have another sketch from another site that is a little more involved that I can turn on multiple LED's through the 23017 at once but still no web interface. I would be interested to see what you have done ! Thank you!
John[/color]
i will get it running tonight and upload code and pictures.
I have uploaded my code that I just tested to
https://github.com/samighi/ESP8266-sample-23017-support Please note that it uses GPIO4 and 5 to avoid any issues with GPIO 0/2/15. I assume you can flash the device with Arduino IDE 1.6.5 (see github readme). The only issue I have is after initial flash, I need to restart the board once or twice. I use the FTDI power to power the chip. Ensuring i used 3.3v FTDI.
the code is copied from somewhere else (probably the example set) and I added
/ledtest to it. you can use /ledtest?A=anyvalue to set the binary value of the 8 LEDs.
Note that 23017 requires one extra byte to be sent so it know which A or B register to work with. PCF8574 doesn't.
key points in the code are
Code: Select all// 23017 setup
Wire.begin(5, 4); // note this could be swapped on some boards
and
Code: Select allvoid ledtest( void ) {
char dataA = server.arg ( 0).toInt() ;
char dataB = server.arg ( 1).toInt() ;
Wire.beginTransmission(mcp_address);
Wire.write(GPIOA);
Wire.write(dataA);
Wire.endTransmission();
Wire.beginTransmission(mcp_address);
Wire.write(GPIOB);
Wire.write(dataB);
Wire.endTransmission();
this is made for my kids Lego City to light up 10s of lights. I personally did 10 LEDs per 23017 just due to cabling issues. I could obviously run 16 LEDs per setup.
The only trick to 23017 setup is simply holding the RESET high. Also, ensure you set A0,A1,A2 properly. It defines the address.
Lastly before I didn't any LED work at all, I ran the Arduino standard I2C scanner code first. That way I could at least know the 23017 was working. Once done, I wrote this code.
Good luck and keep me posted.