Program compile but dosen't work.

When I try to Serial.print a char*, it returns gibberish and a mix of random part of char* from the SRAM. I don’t know what to do or what could help you fix my program.

That’s all.

GreenOS3.ino (11.1 KB)

I'm not sure if its the same problem, but I just had something similar happen. Check the Baud rate that you set when you began your Serial, and make sure it matches with the Baud rate in the serial monitor. Mine were different, after changing the Baud rate in the serial monitor the output was what I expected it to be. Hope this helps!

SoftwareSerial mySerial(0, 2);Digital pin zero is used by hardware serial on most Arduinos. Which board are you using ?

In setup

  char* FileCode = "";
  while (MF.available()) {
    //FileCode = (FileCode + char(;
    FileCode += char(;

So FileCode is a pointer to a char somewhere in memory (let's say it points to location 100). Next you read a character from file (e.g. 'A', decimal value 65) and add that to the pointer; now FileCode points to a totally different location in memory (165).

I suggest that you take that little part (and some of the SD stuff that you need), dump it in a new sketch and debug that till you understand what it's doing; it's definitely not creating an array with data from file.

I vote for ‘baud rate’. Check that your Serial.begin() matches the baud rate in the dropdown of your IDE.