Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By Samighi11
#28704

The one sketch for the 23017 would use 0 to 15 for the LED's but could only turn 1 at a time on where the second one can turn multiple LED's by using 0 to 255..

Any ideas or directions to pursue would be greatly appreciated.

Thank you

John Frankforther[/color]


do you have access to any esp8266 other than -01? I am using a break out of -12 to do what you ask. I was successful in simply passing the esp8266 A=255, B=255 (or any number) to control up to 10 lights (can be up to 16, just board wiring limitation).

I decided not to have the ESP8266 serve the page but used a well know server I own to send the commands to ESP8266.

I am myself a bit limited on how ESP8266-01 can control I2C, but it has been done before. Once you get 01 to do I2C (Arudino I2C scanner with IDE 1.6.5 works well), then you can control the 23017.

I will be happy to start a new thread on how this can be done, it is a combination of old threads and some of the code I have. Please let me know if you want to proceed. it will probably take a day or two to get what you want operational. I have it operational on ESP8266-12 right now. (using other pins than 0,2,15).

In addition, I am excited to see how tieing the RTS and CTS to the ESP module will ease the programming of it (now supported in IDE 1.6.5). I currently ground GPIO2 (I think) and RESET to start the firmware flash process.
User avatar
By martinayotte
#28715
johntech2014 wrote:Yes I did get the Adafruit sketch to work on the ESP8266-01. Now I want to go to the next step and control the LED's on/off via web page buttons. So I will design a simple web interface with 15 buttons then try to figure out how to transfer a button push to turn on associated LED on the MC23017. I have seen it done simply in Lua .

You should look at ESP8266WebServer example.
You can then use some URL for buttons like "/led_on?led_no=5", then in an handler "handleLEDOn()" function, you will received the argument "led_no" with value "5" and doing the call to mcp.digitalWrite(5, HIGH) accordingly. Same thing with "handleLEDOff()" function.
User avatar
By johntech2014
#28730

do you have access to any esp8266 other than -01? I am using a break out of -12 to do what you ask. I was successful in simply passing the esp8266 A=255, B=255 (or any number) to control up to 10 lights (can be up to 16, just board wiring limitation).

I decided not to have the ESP8266 serve the page but used a well know server I own to send the commands to ESP8266.

I am myself a bit limited on how ESP8266-01 can control I2C, but it has been done before. Once you get 01 to do I2C (Arudino I2C scanner with IDE 1.6.5 works well), then you can control the 23017.

I will be happy to start a new thread on how this can be done, it is a combination of old threads and some of the code I have. Please let me know if you want to proceed. it will probably take a day or two to get what you want operational. I have it operational on ESP8266-12 right now. (using other pins than 0,2,15).

In addition, I am excited to see how tieing the RTS and CTS to the ESP module will ease the programming of it (now supported in IDE 1.6.5). I currently ground GPIO2 (I think) and RESET to start the firmware flash process.


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
User avatar
By Samighi11
#28731
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.