You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I learned how to control I2C1 of pico W for SunFounder I2C LCD2004 by #2737 thread of this arduino-pico Discussion. Of cource this libray can control I2C0 of pico W for SunFounder I2C LCD2004.
But I recently noticed that the SunFounder I2C LCD2004 connected to port I2C0 of pico W and the the SunFounder I2C LCD2004 connected to I2C1 of pico W do not work well in one source code, named "Code for I2C0 & I2C1". The SunFounder I2C LCD2004 which is connected to I2C1, shows Alternately every 2 seconds
one mode
0: I2C1 0x27 Num=xxx
1: I2C1 0x27 Num=xxx
2: I2C1 0x27 Num=xxx
3: I2C1 0x27 Num=xxx
the other mode
0:
1:
2:
3:
xxx means Count Number
Count Number increses every 2 secnds.
But The SunFounder I2C LCD2004 which is connected to I2C0 shows nothing.
Why doesn't The SunFounderI2C LCD2004 connected to I2C0 work ? How do you control the SunFounder I2C LCD2004 connected to I2C0 ?
Any advise make me pleased.
Please See attached Pictures(mode1_I2C0_I2C1.JPG and mode2_I2C0_I2C1.JPG) Also I attached zip of "Code for I2C0 & I2C1" ino file, LiquidCrystal_I2C.h and LiquidCrystal_I2C.cpp.(= 4c_I2C0_I2C1picoW_even_Just_updated.zip) 4c_I2C0_I2C1picoW_even_Just_updated.zip
I added below.
"Code for I2C0" works well, namely shows Alternately every 2 seconds.
In "Code for I2C0" pico W controls only I2C0 port.
one mode
0: I2C0 0x27 Num=xxx
1: I2C0 0x27 Num=xxx
2: I2C0 0x27 Num=xxx
3: I2C0 0x27 Num=xxx
the other mode
0:
1:
2:
3:
"Code for I2C1" works well, namely shows Alternately every 2 seconds.
In "Code for I2C1" pico W controls only I2C1 port.
one mode
0: I2C1 0x27 Num=xxx
1: I2C1 0x27 Num=xxx
2: I2C1 0x27 Num=xxx
3: I2C1 0x27 Num=xxx
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I learned how to control I2C1 of pico W for SunFounder I2C LCD2004 by #2737 thread of this arduino-pico Discussion. Of cource this libray can control I2C0 of pico W for SunFounder I2C LCD2004.
But I recently noticed that the SunFounder I2C LCD2004 connected to port I2C0 of pico W and the the SunFounder I2C LCD2004 connected to I2C1 of pico W do not work well in one source code, named "Code for I2C0 & I2C1". The SunFounder I2C LCD2004 which is connected to I2C1, shows Alternately every 2 seconds
one mode
0: I2C1 0x27 Num=xxx
1: I2C1 0x27 Num=xxx
2: I2C1 0x27 Num=xxx
3: I2C1 0x27 Num=xxx
the other mode
0:
1:
2:
3:
xxx means Count Number
Count Number increses every 2 secnds.
But The SunFounder I2C LCD2004 which is connected to I2C0 shows nothing.
Why doesn't The SunFounderI2C LCD2004 connected to I2C0 work ? How do you control the SunFounder I2C LCD2004 connected to I2C0 ?
Any advise make me pleased.
Please See attached Pictures(mode1_I2C0_I2C1.JPG and mode2_I2C0_I2C1.JPG) Also I attached zip of "Code for I2C0 & I2C1" ino file, LiquidCrystal_I2C.h and LiquidCrystal_I2C.cpp.(= 4c_I2C0_I2C1picoW_even_Just_updated.zip)



4c_I2C0_I2C1picoW_even_Just_updated.zip
I added below.
In "Code for I2C0" pico W controls only I2C0 port.
one mode
0: I2C0 0x27 Num=xxx
1: I2C0 0x27 Num=xxx
2: I2C0 0x27 Num=xxx
3: I2C0 0x27 Num=xxx
the other mode
0:
1:
2:
3:
In "Code for I2C1" pico W controls only I2C1 port.
one mode
0: I2C1 0x27 Num=xxx
1: I2C1 0x27 Num=xxx
2: I2C1 0x27 Num=xxx
3: I2C1 0x27 Num=xxx
the other mode
0:
1:
2:
3:
//Code for I2C0 & I2C1 ---------------------------------------------------------
#include <Wire.h>
//#include <LiquidCrystal_I2C.h>
#include "LiquidCrystal_I2C.h"
int exLED = 0;
int Num = 0;
char Buf[32];
LiquidCrystal_I2C lcd0(0x27, 20, 4);
LiquidCrystal_I2C lcd1(0x27, 20, 4);
void setup()
{
pinMode(exLED, OUTPUT); //Led port: out
// I2C0 pin Setting
Wire.setSDA(16); //pin21 (GP16 I2C0 SDA)
Wire.setSCL(17); //pin22 (GP17 I2C0 SCL)
Wire.begin(); //
lcd0.begin2(Wire);
lcd0.backlight();
// I2C1 pin Setting
Wire1.setSDA(18); //pin24 (GP18 I2C1 SDA)
Wire1.setSCL(19); //pin25 (GP19 I2C1 SCL)
Wire1.begin(); //
lcd1.begin2(Wire1);
lcd1.backlight();
}
void loop()
{
Num++;
lcd0.setCursor(0,0);
sprintf(Buf,"0: I2C0 0x27 Num=%d", Num);
lcd0.print(Buf);
lcd0.setCursor(0,1);
sprintf(Buf,"1: I2C0 0x27 Num=%d", Num);
lcd0.print(Buf);
lcd0.setCursor(0,2);
sprintf(Buf,"2: I2C0 0x27 Num=%d", Num);
lcd0.print(Buf);
lcd0.setCursor(0,3);
sprintf(Buf,"3: I2C0 0x27 Num=%d", Num);
lcd0.print(Buf);
lcd1.setCursor(0,0);
sprintf(Buf,"0: I2C1 0x27 Num=%d", Num);
lcd1.print(Buf);
lcd1.setCursor(0,1);
sprintf(Buf,"1: I2C1 0x27 Num=%d", Num);
lcd1.print(Buf);
lcd1.setCursor(0,2);
sprintf(Buf,"2: I2C1 0x27 Num=%d", Num);
lcd1.print(Buf);
lcd1.setCursor(0,3);
sprintf(Buf,"3: I2C1 0x27 Num=%d", Num);
lcd1.print(Buf);
digitalWrite(exLED, HIGH); //No1 Pin LED:On
delay(2000);
digitalWrite(exLED, LOW); //No1 Pin LED:Off
lcd0.setCursor(0,0);
lcd0.print("0: ");
lcd0.setCursor(0,1);
lcd0.print("1: ");
lcd0.setCursor(0,2);
lcd0.print("2: ");
lcd0.setCursor(0,3);
lcd0.print("3: ");
lcd1.setCursor(0,0);
lcd1.print("0: ");
lcd1.setCursor(0,1);
lcd1.print("1: ");
lcd1.setCursor(0,2);
lcd1.print("2: ");
lcd1.setCursor(0,3);
lcd1.print("3: ");
delay(2000);
}
//Code for I2C0 ---------------------------------------------------------
#include <Wire.h>
//#include <LiquidCrystal_I2C.h>
#include "LiquidCrystal_I2C.h"
int exLED = 0;
int Num = 0;
char Buf[32];
LiquidCrystal_I2C lcd0(0x27, 20, 4);
//LiquidCrystal_I2C lcd1(0x27, 20, 4);
void setup()
{
pinMode(exLED, OUTPUT); //Led port: out
// I2C0 pin Setting
Wire.setSDA(16); //pin21 (GP16 I2C0 SDA)
Wire.setSCL(17); //pin22 (GP17 I2C0 SCL)
Wire.begin(); //
lcd0.begin2(Wire);
lcd0.backlight();
// // I2C1 pin Setting
// Wire1.setSDA(18); //pin24 (GP18 I2C1 SDA)
// Wire1.setSCL(19); //pin25 (GP19 I2C1 SCL)
// Wire1.begin(); //
// lcd1.begin2(Wire1);
// lcd1.backlight();
}
void loop()
{
Num++;
lcd0.setCursor(0,0);
sprintf(Buf,"0: I2C0 0x27 Num=%d", Num);
lcd0.print(Buf);
lcd0.setCursor(0,1);
sprintf(Buf,"1: I2C0 0x27 Num=%d", Num);
lcd0.print(Buf);
lcd0.setCursor(0,2);
sprintf(Buf,"2: I2C0 0x27 Num=%d", Num);
lcd0.print(Buf);
lcd0.setCursor(0,3);
sprintf(Buf,"3: I2C0 0x27 Num=%d", Num);
lcd0.print(Buf);
// lcd1.setCursor(0,0);
// sprintf(Buf,"0: I2C1 0x27 Num=%d", Num);
// lcd1.print(Buf);
// lcd1.setCursor(0,1);
// sprintf(Buf,"1: I2C1 0x27 Num=%d", Num);
// lcd1.print(Buf);
// lcd1.setCursor(0,2);
// sprintf(Buf,"2: I2C1 0x27 Num=%d", Num);
// lcd1.print(Buf);
// lcd1.setCursor(0,3);
// sprintf(Buf,"3: I2C1 0x27 Num=%d", Num);
// lcd1.print(Buf);
digitalWrite(exLED, HIGH); //No1 Pin LED:On
delay(2000);
digitalWrite(exLED, LOW); //No1 Pin LED:Off
lcd0.setCursor(0,0);
lcd0.print("0: ");
lcd0.setCursor(0,1);
lcd0.print("1: ");
lcd0.setCursor(0,2);
lcd0.print("2: ");
lcd0.setCursor(0,3);
lcd0.print("3: ");
// lcd1.setCursor(0,0);
// lcd1.print("0: ");
// lcd1.setCursor(0,1);
// lcd1.print("1: ");
// lcd1.setCursor(0,2);
// lcd1.print("2: ");
// lcd1.setCursor(0,3);
// lcd1.print("3: ");
delay(2000);
}
//Code for I2C1 ---------------------------------------------------------
#include <Wire.h>
//#include <LiquidCrystal_I2C.h>
#include "LiquidCrystal_I2C.h"
int exLED = 0;
int Num = 0;
char Buf[32];
//LiquidCrystal_I2C lcd0(0x27, 20, 4);
LiquidCrystal_I2C lcd1(0x27, 20, 4);
void setup()
{
pinMode(exLED, OUTPUT); //Led port: out
// // I2C0 pin Setting
// Wire.setSDA(16); //pin21 (GP16 I2C0 SDA)
// Wire.setSCL(17); //pin22 (GP17 I2C0 SCL)
// Wire.begin(); //
// lcd0.begin2(Wire);
// lcd0.backlight();
// I2C1 pin Setting
Wire1.setSDA(18); //pin24 (GP18 I2C1 SDA)
Wire1.setSCL(19); //pin25 (GP19 I2C1 SCL)
Wire1.begin(); //
lcd1.begin2(Wire1);
lcd1.backlight();
}
void loop()
{
Num++;
// lcd0.setCursor(0,0);
// sprintf(Buf,"0: I2C0 0x27 Num=%d", Num);
// lcd0.print(Buf);
// lcd0.setCursor(0,1);
// sprintf(Buf,"1: I2C0 0x27 Num=%d", Num);
// lcd0.print(Buf);
// lcd0.setCursor(0,2);
// sprintf(Buf,"2: I2C0 0x27 Num=%d", Num);
// lcd0.print(Buf);
// lcd0.setCursor(0,3);
// sprintf(Buf,"3: I2C0 0x27 Num=%d", Num);
// lcd0.print(Buf);
lcd1.setCursor(0,0);
sprintf(Buf,"0: I2C1 0x27 Num=%d", Num);
lcd1.print(Buf);
lcd1.setCursor(0,1);
sprintf(Buf,"1: I2C1 0x27 Num=%d", Num);
lcd1.print(Buf);
lcd1.setCursor(0,2);
sprintf(Buf,"2: I2C1 0x27 Num=%d", Num);
lcd1.print(Buf);
lcd1.setCursor(0,3);
sprintf(Buf,"3: I2C1 0x27 Num=%d", Num);
lcd1.print(Buf);
digitalWrite(exLED, HIGH); //No1 Pin LED:On
delay(2000);
digitalWrite(exLED, LOW); //No1 Pin LED:Off
// lcd0.setCursor(0,0);
// lcd0.print("0: ");
// lcd0.setCursor(0,1);
// lcd0.print("1: ");
// lcd0.setCursor(0,2);
// lcd0.print("2: ");
// lcd0.setCursor(0,3);
// lcd0.print("3: ");
lcd1.setCursor(0,0);
lcd1.print("0: ");
lcd1.setCursor(0,1);
lcd1.print("1: ");
lcd1.setCursor(0,2);
lcd1.print("2: ");
lcd1.setCursor(0,3);
lcd1.print("3: ");
delay(2000);
}
Beta Was this translation helpful? Give feedback.
All reactions