<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[M5StamPLC and the Backlight]]></title><description><![CDATA[<p dir="auto">Hello,<br />
I would like to turn off the backlight of the M5StamPLC when there's nothing to see.<br />
The set_backlight function from the M5 library doesn't seem to work. The reason<br />
is probably that there is no "normal" LCD_BL pin:</p>
<pre><code>// Display
#define STAMPLC_PIN_LCD_MOSI 8
#define STAMPLC_PIN_LCD_MISO 9
#define STAMPLC_PIN_LCD_SCLK 7
#define STAMPLC_PIN_LCD_DC 6
#define STAMPLC_PIN_LCD_CS 12
#define STAMPLC_PIN_LCD_RST 3
#define STAMPLC_PIN_LCD_BUSY -1
#define STAMPLC_PIN_LCD_BL -1
</code></pre>
<p dir="auto">In the M5StamPLC, the PI4IOE5V6408 is responsible for the backlight, and pin 7 is responsible for it.</p>
<p dir="auto">Unfortunately, my own routine doesn't work either:</p>
<pre><code>void my_set_backlight(bool o) {
  PI4IOE5V6408_Class p;
  // false input, true output
  p.setDirection(7, true);
  // false off, true on ?
  p.digitalWrite(7, o);
}
</code></pre>
<p dir="auto">Does anyone have an idea, or even better, a solution?</p>
]]></description><link>https://community.m5stack.com/topic/7724/m5stamplc-and-the-backlight</link><generator>RSS for Node</generator><lastBuildDate>Tue, 28 Apr 2026 23:55:21 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/7724.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 30 Jul 2025 12:41:15 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to M5StamPLC and the Backlight on Thu, 31 Jul 2025 06:52:10 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/felmue" aria-label="Profile: felmue">@<bdi>felmue</bdi></a>,</p>
<p dir="auto">thank you very much for your quick support, it really helped me.</p>
<p dir="auto">It didn't work in my "big" program, but I wrote a small test program, and it fully meets the requirements:</p>
<pre><code>#include &lt;M5StamPLC.h&gt;       

void my_set_backlight(bool o) {
  PI4IOE5V6408_Class p;
  p.setDirection(7, true);  // false input, true output
  p.digitalWrite(7, !o);    // false on, true off
}

void printAndWait(String s) {
  M5StamPLC.Display.println(" " + s);
  delay(4000);
}

void setup() {
  Serial.begin(115200);
  M5StamPLC.begin(); 
  M5StamPLC.Display.setTextSize(3);
}

void loop() {
  M5StamPLC.Display.fillScreen(TFT_BLACK);
  M5StamPLC.Display.setCursor(0, 10);
  printAndWait("Test 1");
  printAndWait("Test 2");
  my_set_backlight(false);
  printAndWait("Test 3");
  my_set_backlight(true);
  printAndWait("Test 4");
}
</code></pre>
<p dir="auto">You can see it not only in the dark screen, but also in the power consumption, which is reduced by about 20%.</p>
<p dir="auto">I suspect that in my "big" program, someone is turning the lights back on (and working against me).</p>
<p dir="auto">Best regards,<br />
Uwe</p>
]]></description><link>https://community.m5stack.com/post/29671</link><guid isPermaLink="true">https://community.m5stack.com/post/29671</guid><dc:creator><![CDATA[GermanSheepDog]]></dc:creator><pubDate>Thu, 31 Jul 2025 06:52:10 GMT</pubDate></item><item><title><![CDATA[Reply to M5StamPLC and the Backlight on Wed, 30 Jul 2025 16:40:55 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/germansheepdog" aria-label="Profile: GermanSheepDog">@<bdi>GermanSheepDog</bdi></a></p>
<p dir="auto">below is an alternative function which works for me too:</p>
<pre><code>#define PI4IOE5V6408_ADDR 0x43
#define OUTPUT_REG 0x05

void my_set_backlight(bool o) {
  uint8_t data = M5.In_I2C.readRegister8(PI4IOE5V6408_ADDR, OUTPUT_REG, 200000);
  if(o == true) data |= 0b10000000;
  else data &amp;= ~0b10000000;
  M5.In_I2C.writeRegister8(PI4IOE5V6408_ADDR, OUTPUT_REG, data, 200000);
}
</code></pre>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/29665</link><guid isPermaLink="true">https://community.m5stack.com/post/29665</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Wed, 30 Jul 2025 16:40:55 GMT</pubDate></item><item><title><![CDATA[Reply to M5StamPLC and the Backlight on Wed, 30 Jul 2025 15:43:48 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/germansheepdog" aria-label="Profile: GermanSheepDog">@<bdi>GermanSheepDog</bdi></a></p>
<p dir="auto">your <code>my_set_backlight()</code> function works for me and <code>my_set_backlight(true)</code> turns the backlight off (inverted logic).</p>
<pre><code>void my_set_backlight(bool o) {
  PI4IOE5V6408_Class p;
  // false input, true output
  p.setDirection(7, true);
  // false off, true on ?
  p.digitalWrite(7, o);
}
void setup()
{
  auto cfg = M5.config();
  cfg.serial_baudrate = 115200;
  M5.begin(cfg);
  M5StamPLC.begin();
}
void loop()
{
  M5.update();
  if(M5.BtnA.wasClicked() == true)
  {
    Serial.println("BtnA clicked - backlight on");
    my_set_backlight(false);
  }
  if(M5.BtnC.wasClicked() == true)
  {
    Serial.println("BtnC clicked - backlight off");
    my_set_backlight(true);
  }
}
</code></pre>
<p dir="auto">Thanks<br />
Felix</p>
<p dir="auto">P.S. the AI generated code did not work for me.</p>
]]></description><link>https://community.m5stack.com/post/29663</link><guid isPermaLink="true">https://community.m5stack.com/post/29663</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Wed, 30 Jul 2025 15:43:48 GMT</pubDate></item><item><title><![CDATA[Reply to M5StamPLC and the Backlight on Wed, 30 Jul 2025 14:45:43 GMT]]></title><description><![CDATA[<p dir="auto">The solution from <a href="http://Chat.M5Stack.com" target="_blank" rel="noopener noreferrer nofollow ugc">Chat.M5Stack.com</a> didn't work either:</p>
<pre><code>#include &lt;M5StamPLC.h&gt;
#include &lt;Wire.h&gt;

#define PI4IOE5V6408_ADDR 0x43  // I2C-address
#define DIR_REG 0x06                 
#define OUTPUT_REG 0x02      

void setup() {
  M5StamPLC.begin();  // Initialisiert I2C-Bus (G15=SCL, G13=SDA)
  
  // P7 (LCD_BL) is output, Set Bit 7 of DIR_REG = 0
  Wire.beginTransmission(PI4IOE5V6408_ADDR);
  Wire.write(DIR_REG);
  Wire.write(0x7F);  // 0b01111111 (only P7=output)
  Wire.endTransmission();
}

void setBacklight(bool on) {
  Wire.beginTransmission(PI4IOE5V6408_ADDR);
  Wire.write(OUTPUT_REG);
  Wire.write(on ? 0xFF : 0x7F);  // P7=1 (on) or 0 (off)
  Wire.endTransmission();
}
</code></pre>
]]></description><link>https://community.m5stack.com/post/29662</link><guid isPermaLink="true">https://community.m5stack.com/post/29662</guid><dc:creator><![CDATA[GermanSheepDog]]></dc:creator><pubDate>Wed, 30 Jul 2025 14:45:43 GMT</pubDate></item></channel></rss>