[Solved] LCD Printing Corrupt Characters from VS Code Only

Hi everyone,

Obligatory “I’m new, please be gentle”

My Problem

  • When I upload code from PlatformIO, the characters displayed on the lcd are wrong/corrupted garbage. The output is always the same.*
  • Identical code works fine when uploaded from the Arduino IDE

Below is info you may ask me for immediately, followed by ideas I’ve had

Hardware Information

  • Windows 10, 64 bit, version 21H2
  • VS Code version 1.63.2
  • Using Teensy 2.0++
  • Teensy Loader v1.55

Code
Identical code works properly when uploaded with Arduino IDE

#include <Arduino.h>
#include <Wire.h> // Necessary to avoid library dependencies issue in VS Code -that’s a different issue
#include <LiquidCrystal.h>

const int RS = 18, EN = 19, D4 = 23, D5 = 24, D6 = 25, D7 = 26;
LiquidCrystal lcd(RS, EN, D4, D5, D6, D7);

void setup() {
lcd.begin(16, 2);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(“anything”);
}

void loop() {
}

platformio.ini

[env:teensy2pp]
platform = teensy
board = teensy2pp
framework = arduino
lib_deps =
fmalpartida/LiquidCrystal@^1.5.0

Ideas

  • Complaining loudly has had no noticable effect.
  • I couldn’t find anything on Google, so maybe I just can’t find the special combination of google-fu words to find what I need.
  • I’ve attempted creating a new, clean project and removing any unnnecessary code.
  • Serial monitor works properly, and I can blink LEDs without issue. This leads me to believe it’s not a COM port issue, though I have tried manually adjusting that -no difference.
  • There are 2 LCD displays connected to identical pins on the Teensy. That is to say that one set of microcontroller outputs connects to 2 displays. Again, they work properly when uploaded through Arduino IDE, but they are both different when uploaded through VS Code. This leads me to believe I have something setup inproperly within VS Code / PlatformIO

edit: formatting

Are you using the same library source for the Arduino IDE and PlatformIO?

Try using arduino-libraries/LiquidCrystal@^1.0.7 instead.

That did it.
Thanks for your help!

So I suppose this indicates that there’s an issue in the extended library(?)
Is that related to this issue, or maybe beside it? https://github.com/platformio/platformio-core/issues/4152

Well if the arduino-libraries version worked then the other version has to have some bug in it that manifests itself in Teensy. Maybe you can report it at GitHub - fmalpartida/New-LiquidCrystal: Clone of the new liquid crystal library from: https://bitbucket.org/fmalpartida/new-liquidcrystal. Though, the library has not had any code modifications since 2016, so, relatively dead… The GitHub - arduino-libraries/LiquidCrystal: Liquid Crystal Library for Arduino library is more active.

No, this is a different issue: When using the LiquidMenu library, PlatformIO can’t detect is sub-dependencies ( LiquidCrystal or LiquidCrystal_I2C). Since you’re using LiquidCrystal directly, this does not apply to you.

1 Like

I’ll follow up in those places.
Thank you!