Skip to content

Arduino after install boards esp32 m5nanoc6 output to M5 OLED unit fails #10

@PaulskPt

Description

@PaulskPt

I have a good working Arduino Sketch that I now am porting from a M5Dial to my new M5NanoC6. I have a M5 OLED and a M5 RTC unit connected to the M5NanoC6 GROVE port (pins G1 and G2) via a M5 GROVE HUB. The sketch worked OK on the M5NanoC6, regarding the print outputs to the OLED unit, using Tools -> Board -> esp32 -> esp32nanoc6. (esp boards lib v 3.1.0 RC), however statement like "Serial.print(ln) did not result in output on the Serial Monitor. To have the board M5NanoC6 available, I downgraded to esp32 boards lib v 3.0.5 (the current stable version). Then I choosed: Tools -> Board -> esp32 -> M5NanoC6.
The result is that Serial.print(ln) statements are now executing OK (visual in the Serial Monitor), however, I encountered a new problem: no text on the OLED unit. Below an extract of the relevant commands for the I2C communication with the OLED unit:

`
#include <M5NanoC6.h>
#include <M5UnitOLED.h>
#include <M5GFX.h>

#define SDA 1
#define SCL 2
#define I2C_FREQ 400000
#define I2C_PORT 0
#define I2C_ADDR_OLED 0x3c

M5UnitOLED display(SDA, SCL, I2C_FREQ, I2C_PORT, I2C_ADDR_OLED);

M5Canvas canvas(&display);

void setup(void)
{
NanoC6.begin(); // Init NanoC6

Wire.begin(SDA, SCL);

display.init();
display.setRotation(1);
display.setTextColor(WHITE, BLACK);
canvas.setColorDepth(1); // mono color
canvas.setFont(&fonts::FreeSans9pt7b);
canvas.setTextWrap(false);
canvas.setTextSize(1);
canvas.createSprite(display.width() + 64, 72);
}

void disp_msg(String str)
{
canvas.fillScreen(TFT_BLACK);
canvas.clear();
canvas.setTextDatum(middle_center);
canvas.drawString(str, display.width() / 2, display.height() / 2);
canvas.print("Hello World!");
display.waitDisplay();
canvas.pushSprite(&display, 0, (display.height() - canvas.height()) >> 1);

delay(6000);
canvas.fillScreen(TFT_BLACK);
canvas.clear();
}

void loop(void)
{
// More code here...
disp_msg("Reset...");
}
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions