Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Effects not working with text longer that 16 char #28

Open
claudchtiscali opened this issue Sep 7, 2022 · 2 comments
Open

Effects not working with text longer that 16 char #28

claudchtiscali opened this issue Sep 7, 2022 · 2 comments

Comments

@claudchtiscali
Copy link

claudchtiscali commented Sep 7, 2022

/*
This code is not working, the line with effects overlaps at the begining of the line replicating one char
If I change the line fx.applyEffect(text, 11, 18, effect::invert); to fx.applyEffect(text, 11, 15, effect::invert); // bold "Hello"
it does not apply the desired effect but do not overlap

Did I make any mistake ?
*/

#include <Arduino.h>

#include <Wire.h>
#include <LiquidCrystal_PCF8574.h> // should work with any LCD library
LiquidCrystal_PCF8574 lcd(0x27);

void make_char(char c, uint8_t* image){ //need this function to pass to LcdEffects
lcd.createChar(c, image); // so it knows how to make custom characters
}

#include <LcdEffects.h> // the core library
#include <Effects.h> // a collection of common effects
LcdEffects<> fx(make_char); // initialize the LcdEffects library

void setup() {
lcd.begin(20, 4); //change to match the size of your LCD
lcd.setBacklight(255);
}
void loop() {
char text[] = "12345678901234567890"; // puts the text in an array so we can work with it
lcd.setCursor(0,0);
lcd.print(text); //print the text to the first line without any effects (for comparison)

fx.applyEffect(text, 0, 5, effect::invert);
fx.applyEffect(text, 7, 10, effect::bold);
fx.applyEffect(text, 11, 18, effect::invert);

lcd.setCursor(0,1); //now print the text to the second line
lcd.print(text);

delay(1000);
}

@mathertel
Copy link
Owner

mathertel commented Sep 8, 2022 via email

@claudchtiscali
Copy link
Author

claudchtiscali commented Sep 9, 2022

It’s not as you guess because I can print correctly without effects in any part of my 20*4 LCD
I will investigate more within the code library

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants