Hi, I have mcp23017, I wanted to use pins GPA0 - GPA7 for other purposes and GPB1 - GPB 7 for LCD display. I use the Adafruit_MCP23017 and LiquidTWI2 libraries. The problem with looping when I want to write data to the display - nothing is displayed.
I found a problem. If I use lcd.begin (16,2); before mcp.begin (); , everything works but it's only in setup. It doesn't work if I want to write something after the mcp.begin () command.
My code:
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <Wire.h>
#include "Adafruit_MCP23017.h"
#include <LiquidTWI2.h>
#include <Sparkfun_APDS9301_Library.h>
LiquidTWI2 lcd(0);
void setup() {
lcd.setMCPType(LTI_TYPE_MCP23017);
lcd.begin(16, 2);
lcd.print("Hello"); //this working great
mcp.begin(); // after i use this nothing more will appear on the display, only what's left in the setup before mcp.begin
mcp.pinMode(0, OUTPUT); //MCP GPA0 INT1
mcp.pinMode(1, OUTPUT); //MCP GPA1 INT2
mcp.pinMode(2, OUTPUT); //MCP GPA2 INT3
mcp.pinMode(3, OUTPUT); //MCP GPA3 INT4 relay
}
void loop() {
lcd.setCursor(0, 1);
lcd.print(millis()/1000);
}
Is it somehow combined to make it work? Or how should I do it ? Thank you for answers.