Uno WiFi Rev2 Memory issues

The following code works perfectly on Uno and Mega, but not a brand new Uno WiFi Rev2. The strcpy function has no effect on the WiFi Rev2.

char* tags = {“0001”, “0002”, “0003”, “0004”};

void setup() {

Serial.begin(9600);
while (!Serial) {
; // wait for USB serial port to connect.
}

for (int i=0; i<4; i++) Serial.println(tags*);*

  • Serial.println();*
  • strcpy(tags[2],“0009”);*
    _ for (int i=0; i<4; i++) Serial.println(tags*);_
    _
    Serial.println();_
    _
    }_
    Output
    _
    `001*_
    0002
    0003
    0004
    0001
    0002
    0003
    0004
    Notice the strange first character.
    Does anyone think this is an actual bug with the board or more likely a memory issue? Any other possible causes?

bryan_pedersen:
Notice the strange first character.

This is a problem with the way the serial output works on the Uno WiFi Rev2. I've found a delay of 100 us between the call to Serial.begin() and the first call to Serial.print() makes it work correctly. I have no clue why this is necessary. The same sort of thing happens with the ESP8266.

bryan_pedersen:
The strcpy function has no effect on the WiFi Rev2.

Try changing this line:

char* tags[] = {"0001", "0002", "0003", "0004"};

to:

char tags[][5] = {"0001", "0002", "0003", "0004"};

Thanks.

I agree there could be a stray character when using the serial port initially. However that isn't the main issue. Changing to a 2-D array also doesn't work. The clue is that the code executes correctly on other platforms.

I am thinking the board may be faulty. I would like to hear though whether there are other people with similar WiFi Rev 2 issues in case it is a compiler or microcode problem.

You'll probably have more luck getting help if you learn to post your code properly, you can learn how by reading the "How to use this forum" post.

Because you didn't use code tags, the forum recognized part of your code as markup for italics and so your code is invalid.

Even without the code tags issue, your code was still invalid because you didn't bother to add the required loop function.

It's never a good idea to make things difficult for the people you're expecting free help from.

bryan_pedersen:
Changing to a 2-D array also doesn't work.

It works for me.

Thanks for the tip about posting code. I will try to do better. There is no code in the loop, I was trying to isolate the problem. The code is certainly valid as it works fine on other boards. If it works for you then I would say there is some sort of fault. Thanks.