Skip to content

Effects not working with text longer that 16 char #28

Open
@claudchtiscali

Description

@claudchtiscali

/*
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);
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions