[WIP] Simple Text Entry

I have uploaded a simply sketch that allows you to capture and store a single piece of text into the EEPROM - I have used it for a high score table but I am sure there are a million uses.

In the samepl sketch you will see the constant 123 - this can be changed to whatever EEPROM location you wish. The NAME_LENGTH constant is exactly that - how long should the text be.

I only allow upper and lower case alpha characters and the space but the code can easily be change to expand / shrink that range.


Feel free to use / abuse it … enhancements and feedback welcome.

Try it online > https://felipemanga.github.io/ProjectABE/?url=https://github.com/filmote/SimpleTextEntry/releases/download/V1.0/SimpleTextEntry.V1.0.hex

Grab the source > https://github.com/filmote/SimpleTextEntry


This looks good. :smiley:

Wow! I can already see this being used in tons of types of games!

1 Like

As I’m never happy to just take something at face value,
I forked, overhauled and added some extra bells:

Most of it is cosmetic apart from the changes to retrieve and the constructor.

1 Like

Nice … except you seem to have screwed up the brackets.

Just kidding, nice enhancements. Do a PR and I will merge it together!


	constexpr bool isLower(char c)
		return (c >= 'a' && c <= 'a');

… doesn’t look right.

Also, I think I prefer my switches in the incrementChar and decrementChar from a readability point of view. Don’t like x as a loop incrementer - using i is so old school.

1 Like

I wasn’t intending to necessarily replace the original.

If you’re happy with all my changes then I can make PR if you want,
but the point was more for the sake of practice.

That said, I would definately class the templating, removal of macros and minor change to the loading code as improvements.
(The loading code change was because when I ran it I was getting things like pilcrows turning up.)

Yep, my finger slipped.

I don’t like using compiler extensions if I can avoid it.
Except that case ASCII_CAPITAL_A ... ASCII_CAPITAL_Y: is non-standard syntax and won’t work on other compilers.

Not unless it’s a coordinate and/or there’s a corresponding y. :P

1 Like

Right … but this code uses the Arduboy library so what other compiler would you use?

Lets merge it in … I like the idea of being able to specify the length of the name.

1 Like

Only the EEPROM bit is Arduino specific,
I could see rest of the NameEditor class being ported to something else.

But more importantly I’m worried about less experienced programmers looking at the code and thinking “I didn’t know you could do that”, getting into the habit of using GCC’s case-range syntax and then later having a massive headache when their case-range switches won’t compile on some other platform.

PR ready.

1 Like


1 Like