Serial.println not working

Hi,

I programmed something, however due to something some serial.println Lines dont appear. Can you check this and give me your advice? The last like 10 Lines are very strange. Before that everything is fine.

#include <Servo.h>

const String Blaster_Name = "Nerf Stryfe";

const int ESC_1_Pin = 5;
const int ESC_2_Pin = 6;
const int Buzzer_1_Pin = 9;
const int Buzzer_2_Pin = 10;
const int Aux_1_Pin = 11;
const int Aux_2_Pin = 12;
const byte Potentiometer_1_Pin = A0;
const byte Potentiometer_2_Pin = A1;
const byte Switch_1_Pin = A2;
const byte Switch_2_Pin = A3;
const byte Magazin_In_Pin = A4;
const byte Jam_Door_Pin = A5;
const byte Trigger_Pin = A6;

const int Serial_Baudrate = 9600;
const int Min_Motor_PWM = 1000;
const int Max_Motor_PWM = 2000;
int Idle_Motor_PWM = 1200; 
const int Min_Aux_1_PWM = 1000;
const int Max_Aux_1_PWM = 2000;
const int Min_Aux_2_PWM = 1000;
const int Max_Aux_2_PWM = 2000;
const int ESC_1_2_Boot_Time = 10000;

// End of the configuration

const String Serial_Connected_Message = "Serial connection established at Baud Rate:";
const String Configuring_Pins_Message = "Pins are being configured. Please wait...";
const String Configuring_Pins_Finished_Message = "Pin configuration completed.";

const String Current_Software_Configuration_Message = "Current software configuration values:";

const String Blaster_Name_Message = "Blaster Name:";
const String ESC_1_Pin_Message = "ESC 1 Pin:";
const String ESC_2_Pin_Message = "ESC 2 Pin:";
const String Buzzer_1_Pin_Message = "Buzzer 1 Pin:";
const String Buzzer_2_Pin_Message = "Buzzer 2 Pin:";
const String Aux_1_Pin_Message = "Auxiliary 1 Pin:";
const String Aux_2_Pin_Message = "Auxiliary 2 Pin:";
const String Potentiometer_1_Pin_Message = "Potentiometer 1 Pin:";
const String Potentiometer_2_Pin_Message = "Potentiometer 2 Pin:";
const String Switch_1_Pin_Message = "Switch 1 Pin:";
const String Switch_2_Pin_Message = "Switch 2 Pin:";
const String Magazin_In_Pin_Message = "Magazine Inserted Pin:";
const String Jam_Door_Pin_Message = "Jam Door Closed Pin:";
const String Trigger_Pin_Message = "Trigger Pin:";

const String Serial_Baudrate_Message = "Serial Baudrate:";
const String Min_Motor_PWM_Message = "Min. Motor PWM Frequency:"; 
const String Max_Motor_PWM_Message = "Max. Motor PWM Frequency:";
const String Idle_Motor_PWM_Message = "Standard IDLE PWM Frequency (No Potentiometer):"; 
const String Min_Aux_1_PWM_Message = "Min. Auxiliary 1 PWM Frequency:";
const String Max_Aux_1_PWM_Message = "Max. Auxiliary 1 PWM Frequency:";
const String Min_Aux_2_PWM_Message = "Min. Auxiliary 2 PWM Frequency:";
const String Max_Aux_2_PWM_Message = "Max. Auxiliary 2 PWM Frequency:";

const String End_Software_Configuration_Message = "End of the configuration.";
const String Playing_Startup_Sound_Message = "Playing startup sound...";
const String Played_Startup_Sound_Message = "Startup sound played.";
const String Waiting_ESC_Boot_Message = "Waiting for ESC(s) to boot...";
const String Waiting_ESC_Finished_Message = "Finished waiting for ESC boot. If it didnt boot, please up ESC_1_2_Boot_Time and check ESC.";

// End of internal configuration

// Setup

void setup() {
  Serial.begin(Serial_Baudrate);
  
  Serial.println(Serial_Connected_Message);
  Serial.println(Serial_Baudrate);
  Serial.println(Configuring_Pins_Message);
  
  pinMode(ESC_1_Pin, OUTPUT);
  pinMode(ESC_2_Pin, OUTPUT);
  pinMode(Buzzer_1_Pin, OUTPUT);
  pinMode(Buzzer_2_Pin, OUTPUT);
  pinMode(Aux_1_Pin, OUTPUT);
  pinMode(Aux_2_Pin, OUTPUT);
  pinMode(Potentiometer_1_Pin, INPUT);
  pinMode(Potentiometer_2_Pin, INPUT);
  pinMode(Switch_1_Pin, INPUT);
  pinMode(Switch_2_Pin, INPUT);
  pinMode(Magazin_In_Pin, INPUT);
  pinMode(Jam_Door_Pin, INPUT);
  pinMode(Trigger_Pin, INPUT);
  
  Serial.println(Configuring_Pins_Finished_Message);
  Serial.println(Current_Software_Configuration_Message);
  
  Serial.println(Blaster_Name_Message);
  Serial.println(Blaster_Name);
  Serial.println(ESC_1_Pin_Message);
  Serial.println(ESC_1_Pin);
  Serial.println(ESC_2_Pin_Message);
  Serial.println(ESC_2_Pin);
  Serial.println(Buzzer_1_Pin_Message);
  Serial.println(Buzzer_1_Pin);
  Serial.println(Buzzer_2_Pin_Message);
  Serial.println(Buzzer_2_Pin);
  Serial.println(Aux_1_Pin_Message);
  Serial.println(Aux_1_Pin);
  Serial.println(Aux_2_Pin_Message);
  Serial.println(Aux_2_Pin);

  Serial.println(Potentiometer_1_Pin_Message);
  Serial.print(F("A"));
  Serial.println((int) (Potentiometer_1_Pin - A0));
  
  Serial.println(Potentiometer_2_Pin_Message);
  Serial.print(F("A"));
  Serial.println((int) (Potentiometer_2_Pin - A0));
  
  Serial.println(Switch_1_Pin_Message);
  Serial.print(F("A"));
  Serial.println((int) (Switch_1_Pin - A0));
  
  Serial.println(Switch_2_Pin_Message);
  Serial.print(F("A"));
  Serial.println((int) (Switch_2_Pin - A0));
  
  Serial.println(Magazin_In_Pin_Message);
  Serial.print(F("A"));
  Serial.println((int) (Magazin_In_Pin - A0));
  
  Serial.println(Jam_Door_Pin_Message);
  Serial.print(F("A"));
  Serial.println((int) (Jam_Door_Pin - A0));
  
  Serial.println(Trigger_Pin_Message);
  Serial.print(F("A"));
  Serial.println((int) (Trigger_Pin - A0));

  Serial.println(Serial_Baudrate_Message);
  Serial.println(Serial_Baudrate);
  Serial.println(Max_Motor_PWM_Message);
  Serial.println(Max_Motor_PWM);
  Serial.println(Min_Motor_PWM_Message);
  Serial.println(Min_Motor_PWM);
  Serial.println(Idle_Motor_PWM_Message);
  Serial.println(Idle_Motor_PWM);
  Serial.println(Min_Aux_1_PWM_Message);
  Serial.println(Min_Aux_1_PWM);
  Serial.println(Max_Aux_1_PWM_Message);
  Serial.println(Max_Aux_1_PWM);  
  Serial.println(Min_Aux_2_PWM_Message);
  Serial.println(Min_Aux_2_PWM);
  Serial.println(Max_Aux_2_PWM_Message);
  Serial.println(Max_Aux_2_PWM);  

  Serial.println(End_Software_Configuration_Message);

  Serial.println(Playing_Startup_Sound_Message);

  tone(Buzzer_1_Pin, 1000);
  tone(Buzzer_2_Pin, 1000);
  delay(500);
  noTone(Buzzer_1_Pin);
  noTone(Buzzer_2_Pin);
  delay(100);
  tone(Buzzer_1_Pin, 2000);
  tone(Buzzer_2_Pin, 2000);
  delay(500);
  noTone(Buzzer_1_Pin);
  noTone(Buzzer_2_Pin);
  delay(100);
  tone(Buzzer_1_Pin, 3000);
  tone(Buzzer_2_Pin, 3000);
  delay(500);
  noTone(Buzzer_1_Pin);
  noTone(Buzzer_2_Pin);

  Serial.println(Played_Startup_Sound_Message);
  Serial.println(Waiting_ESC_Boot_Message);
  delay(ESC_1_2_Boot_Time);
  Serial.println(Waiting_ESC_Finished_Message);
  
}

// End of setup





void loop() {
  

}

Here is the Output of the Serial Monitor:

Serial connection established at Baud Rate:
9600
Pins are being configured. Please wait...
Pin configuration completed.
Current software configuration values:
Blaster Name:
Nerf Stryfe
ESC 1 Pin:
5
ESC 2 Pin:
6
Buzzer 1 Pin:
9
Buzzer 2 Pin:
10
Auxiliary 1 Pin:
11
Auxiliary 2 Pin:
12
Potentiometer 1 Pin:
A0
Potentiometer 2 Pin:
A1
Switch 1 Pin:
A2
Switch 2 Pin:
A3
Magazine Inserted Pin:
A4
Jam Door Closed Pin:
A5
Trigger Pin:
A6
Serial Baudrate:
9600
Max. Motor PWM Frequency:
2000
Min. Motor PWM Frequency:
1000
Standard IDLE PWM Frequency (No Potentiometer):
1200
Min. Auxiliary 1 PWM Frequency:
1000

2000

1000

2000


Test

Please change all your string constants like this:

//Wrong way:
const String STRINGNAME = "The String";

//Right way:
const char STRINGNAME[] PROGMEM = "The String";

And see if anything changes.

It looks like it's your use of String. To test that theory, I did a global search & replace of String to char*. problem solved. I'd suggest though that you just use the strings in your serial prints directly rather than declaring consts. Use the F macro to keep them in progmem - which you've already done for some.

const String

These two should NEVER be used together in the same sketch. If the string that the String wraps is const, there is NO excuse wrapping the string in a String.

Did you mistakenly order an ordinary Arduino, when you thought you were ordering the model with several terabytes of SRAM?

Danois90:
Please change all your string constants like this:

//Wrong way:

const String STRINGNAME = "The String";

//Right way:
const char STRINGNAME PROGMEM = "The String";




And see if anything changes.

The variables can now not be send to the PC anymore. Just see this: ⸮"⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮

const byte Trigger_Pin = A6;

Note: On the SMD-based ATmega328P processors that have A6 and A7 pins, they cannot be used as digital pins. They only added two more inputs to the analog input multiplexer. “Trigger” sound like you intend to use it as a digital pin. If you write “digitalRead(A6)” you will always get LOW but you can use “(analogRead(A6) > 512)” in its place to get HIGH or LOW.

Check your baudrate. By using “const char STRINGNAME PROGMEM = X;” you are storing the strings in flash from where they are loaded with the “flashstringhelper”. Serial.print* does that “on the fly”. More about progmem.

Use 9600 directly not via a S/string!

Stop using pin 1 (d1) that is used for serial

Mark