-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
My Environment
Raspberry Pi Pico2W
Windows 11 PC
Arduino IDE 2.3.6
1.5" I2C oled Module (GME 128128-01-IIC Ver. 2.0)
I wanted to use the Pico2W's GP14=SDA and GP15=SCL pins.
I modified the Wire section of [ pins_arduino.h ] in the following path:
C:\Users<account>\AppData\Local\Arduino15
\packages\rp2040\hardware\rp2040<board version>\variants\rpipico2w
// Wire
#define PIN_WIRE0_SDA (12u)
#define PIN_WIRE0_SCL (13u)
#define PIN_WIRE1_SDA (14u)
#define PIN_WIRE1_SCL (15u)
I modified it like this (saved).
After this operation,
I ran the following sketch on a Pico2W + SH1107 + u8g2lib setup.
#include <Arduino.h>
#include <U8g2lib.h>
#include <Wire.h>
U8G2_SH1107_PIMORONI_128X128_F_HW_I2C u8g2(U8G2_R0);
void setup(void) {
Wire1.setSDA(14);//I2C1pin
Wire1.setSCL(15);//I2C1pin
Wire1.begin();
u8g2.begin();
}
void loop(void) {
u8g2.clearBuffer(); // Clear the internal memory
u8g2.setFont(u8g2_font_ncenB14_tr); // Choose a suitable font
u8g2.drawStr(0,30,"Hello World!"); // Write something to the internal memory
u8g2.sendBuffer();
delay(1000);
}
When I ran this sketch,
the IDE compiled successfully and output "Writing completed"...
However,
Even though the display is connected to
GP14=SDA and GP15=SCL, it doesn't display anything.
However,
When I reconnect the display to GP12=SDA, GP13=SCL
(I2C0 pin),
it outputs to GP12/13, contrary to the sketch,
and the display does display normally.
In this sketch,
void setup(void) {
Wire1.setSDA(14); // I2C1 pin
Wire1.setSCL(15); // I2C1 pin
Wire1.begin();
Is the sketch ignoring the code
that uses the I2C1 pin?
Please tell me the code to use I2C1pin.