and
is somehow contradictory.
Post the last version of your sketch, in a new post, in code tags,
previously formatted with ctrl-T in the IDE.
Half an hour later...
So get your spoon ready and switch the brain off, if it was on. ![]()
#include <LiquidCrystal_I2C.h>
uint16_t x = 0;
const uint8_t input = A0;
bool smiliesVisible = true;
uint32_t lastSwap;
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
pinMode(input, INPUT_PULLUP);
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print(F(" ROUND COUNTER "));
lcd.setCursor(0, 1);
lcd.print(x);
lcd.print(F(" = SMILIES "));
}
void loop() {
bool intputActive = digitalRead(input) == LOW;
if (intputActive ) {
lcd.setCursor (0, 1);
lcd.print(++x);
}
if (millis() - lastSwap >= 250) {
lastSwap = millis();
lcd.setCursor(lenNum(x), 1);
lcd.print(smiliesVisible ? F(" ") : F(" = SMILIES"));
smiliesVisible = not smiliesVisible;
}
}
uint8_t lenNum(uint16_t check) {
if (check < 10) {
return 1;
}
if (check < 100) {
return 2;
}
if (check < 1000) {
return 3;
}
if (check < 10000) {
return 4;
}
return 5;
}