How to tell what part of the code is running-FASTLED lib

I'm using a fastLED library example code to test a sequence of addressable RGB LED's, specifically the NoisePlusPalatte example sketch (code was too long to post). The code works perfectly, but in this example sketch there is only one part the entire LED display that I really like and want to repeat over and over. However, I don't know which part of the code corresponds to the sequence I like. Ideally I would like to understand the code to see where that sequence is, but is there another method where I can see on my computer in real time how the Arduino is going through the code so I can see where it is when it hits the section I like? Any advice appreciated. I will definitely be trying to understand the code itself first and foremost, but there is a lot I don't understand about it.

[u]I also figured I could do the following to find the section of code:[/u] -Code the on board LED on the Arduino to light up and move that to different parts of the code until it lit up during the sequence I wanted -Go through and take out piece by piece of code until I deleted the part I liked and then I'd know where it was

The solutions you found are good ones, especially the LED. Sometimes you need more information than an LED can easily provide though. The most common solution is to add a bunch of Serial prints, then open Serial Monitor while the code is running. This is frequently used as a way to get debug output from your code. The downside to this is the serial communication will significantly slow things down and use a lot of memory. The added delay in the code can even cause or hide bugs, in that way the LED solution is better as that can be done without slowing your code down much as long as you don't use delay(). So it's best to set things up so that the debug serial prints can be disabled when you don't need it.

It's actually very easy to do this in your code with no overhead, only requires adding two lines and none of your debug prints need to be changed:

#define DEBUG true  //set to true for debug output, false for no debug ouput
#define Serial if(DEBUG)Serial

Add this to setup() if you are using a Leonardo, Pro Micro, or other ATmega32U4 based board and don't want the program to run until the Serial Monitor has been opened while debug output is enabled:

while (DEBUG && !Serial);

This can easily be extended to allow multiple levels of debug output, still with no overhead:

#define DEBUG_ERROR true

#define DEBUG_WARNING true


void setup() {
  while (!Serial);
  DEBUG_ERROR_SERIAL.println("This is an error message");
  DEBUG_WARNING_SERIAL.println("This is a warning message");
  DEBUG_INFORMATION_SERIAL.print("The state of pin 5 is ");
  DEBUG_INFORMATION_SERIAL.println(digitalRead(5) ? "HIGH" : "LOW");
  Serial.println("This is standard program output");

void loop() {}

It can also be useful if you use Serial in your non-debug code and only want to turn the debug output on/off.

You can use the boolean debug macros to switch on and off other parts of your code too.