Serial communication menu wont run?

im trying to use the serial monitor with a print menu i programmed however when i run the program i get no compiler issues but it wont print anything to the serial monitor??

here is my code i am using 3 stepper motors and h bridges.

Forkedd3_13.ino (4.97 KB)

Code looks okay. Does it print anything if you disconnect all the other hardware?

-br

when i opened the serial monitor it said nothing the whole execution which makes me wonder if i had everything sync up right? i used a usb on the front of the computer pluged into the arduino uno and ran the compile and upload (not upload using programmer) i also had it set to com1 and AVRISP mkII. this is my first time using the arduino board and im not running it off of my computer, so i am not entirely sure if the configuration is what is ideal?

Which Arduino are you using? If it is a Nano, UNO or other 328-base processor, it will only have 2kB of sram and with such a small amount you can rapidly run into problems with the String class.

Pete

i am using the uno, would this cause nothing to run in the monitor? are there any reasonable ways around this?

What baud rate have you got the serial monitor set to and does it match the baud rate in the code (9600) ? I get your menu on the screen when I run your code.

With all those delays in your code it is not going to be very quick at reacting to input though.

Debugging angles I would check:

Does output to the serial port work if you disconnect all the external hardware? (Theory: the hardware is drawing too much current, or is wired in a short circuit, crowbarring the power supply and keeping the Arduino in reset.)

Does a simple sketch to print to the serial port work with the hardware connected? (Confirm serial port works)

-br

UKHeliBob: What baud rate have you got the serial monitor set to and does it match the baud rate in the code (9600) ? I get your menu on the screen when I run your code.

With all those delays in your code it is not going to be very quick at reacting to input though.

thank you for actually testing it on your end, that really helps. is there a recommendation of a way to eliminate some of the delays but still get the same effect?

billroy: Debugging angles I would check:

Does output to the serial port work if you disconnect all the external hardware? (Theory: the hardware is drawing too much current, or is wired in a short circuit, crowbarring the power supply and keeping the Arduino in reset.)

Does a simple sketch to print to the serial port work with the hardware connected? (Confirm serial port works)

-br

would this be a proper program to test the arduino??

/*
 * Hello World!
 *
 * This is the Hello World! for Arduino. 
 * It shows how to send data to the computer
 */


void setup()                    // run once, when the sketch starts
{
  Serial.begin(9600);           // set up Serial library at 9600 bps
  
  Serial.println("Hello world!");  // prints hello with ending line break 
}

void loop()                       // run over and over again
{
                                  // do nothing!
}

is there a recommendation of a way to eliminate some of the delays but still get the same effect?

Have a look at the BlinkWithoutDelay example in the IDE.

It uses the principle of 'is it time to do anything yet, if not maybe do something else (such as read an input)' rather than 'wait unconditionally for a given time and don't do anything else until the time is up'

ok so i went and tested some things today, go to find out it was the ardino mega not the uno, so when i switched everything to the right settings here is what happened. serial menu wrote, but there was no pause to wait for command. the program just went down the if else statement and did each one, also when i typed in (ex. 1. A1) nothing happened. i just kept running over and over. so i need to get it to wait until it is told what to do, and then only execute that said line