Nicknames and Arduboy

I know :slight_smile: and I still think 5 is ok :wink: BUT I agree with [quote=“MLXXXp, post:20, topic:2638”]
Have both a 6 byte text ID and a 2 byte binary ID, making 8 bytes total stored in system EEPROM.

Sounds absolutely perfect!

Woah! I’ve been gone for a while and this idea has escalated into a full-on discussion with people theorizing and posting scripts into the chat! I’m very new, and have no idea how to do something like this, with a very basic knowledge of hardware and software in my 7th grade mind. I would love to see this idea become reality, as me and my friends would love to set nicknames to our arduboys. :smile:

I’ve started working on this in the Arduboy2 library. I hope to release it soon.

The only difference from what I proposed above is that I’m using read and write in the function names instead of get and set.

uint16_t readUnitID();
void writeUnitID(uint16_t id);
uint8_t readUnitName(uint8_t* name);
void writeUnitName(uint8_t* name);

I’ll be adding a utility, as an example sketch in Arduboy2, for setting the IDs.


Wow! Really?
I think I might make a sketch that allows you to change your nickname as well.
Though, one thing I would like to know is what would happen if you set the nickname to something longer than 3 characters? Will the sketch not compile? or, will the first the letters in that nickname be the only ones that appear?

writeUnitName() will save up to 6 characters from the start of the array that you pass to it as a pointer. The array is treated as a null (0x00) terminated string. Only the number of characters found before the first null will be saved if less than 6 characters. If the string is longer than 6 characters, only the first 6 characters will be saved.

readUnitName() will fill the provided array with a null terminated string containing up to 6 characters. In addition, the return value will be the length of the string. The array that you provide as a pointer must be at least 7 bytes long to allow up to 6 characters plus the null terminator. What a sketch does with the returned string is up to it.

The Arduboy2 library’s Arduboy2 class begin() function will display the unit name at the bottom of the screen, for a short time, under the ARDUBOY logo, after the logo finishes scrolling down. The Arduboy2Base class begin() function won’t display the name because there is no text capability in this class.

If you write your own sketch that allows you to set the unit name:

  • Allow 0 to 6 characters to be set.
  • Don’t allow value 0xFF or line feed (0x0A) or carriage return (0x0D). The name also can’t include 0x00 because that’s the string terminator.

So, How’s the progress with the Nicknames?

I’m just finishing up the example sketch that allows you to set the name and ID. I plan to release in a couple of days or so, after testing and documentation is complete.

1 Like

The unit name and unit ID functions, as discussed above, are now available in Arduboy2 library version 3.1.0

A minor change from my proposal above for the unit name functions:
The name is a char array instead of uint8_t
Using char is more suitable for the purpose and prevents some compiler warnings and other issues.

1 Like