pulsein always returns 0 when using a number from an array.

I am trying to read PWM signals from a spectrum receiver using pulsein. The following is my array int:
To start, here is the code I am using for my array:

int RecieverPins[] = {2,4,7};

As expected I can access my pwm channels by specifying entry 1, 2, or 3 when pulling data from the array.
When I try to access the data stored in RecieverPins[] in my function that uses pulsein, I always get 0 returned in my serial console:

int cmd_read(){
int activePin = args[1];
byte PWM_PIN = RecieverPins[activePin];
int pwm_value;
pwm_value = pulseIn(activePin, HIGH);
Serial.println(pwm_value);
}

But when I access this data directly by writing my code to access a specific pin, I always get the true value:

int cmd_read(){
int activePin = args[1];
byte PWM_PIN = RecieverPins[activePin];
int pwm_value;
pwm_value = pulseIn(2, HIGH);
Serial.println(pwm_value);
}

I have tried running my serial console at different baud rates to see if that is an issue, but it seems to be an issue with how I am accessing the array in these snippets of code. Why is this returning 0 when using the array, but not when using the number directly. What could I use to bypass this issue?
Here is my full code for context: create.arduino.cc

What the heck is args?
What is in element 1?
Why on earth aren’t you passing in the pin index to your function and returning the result?
This isn’t a normal C program with a main function with args and argv!

int cmd_read(uint8_t activePin){
  byte PWM_PIN = RecieverPins[activePin];
  int pwm_value = pulseIn(2, HIGH);
  Serial.println(pwm_value);
  return pwm_value;
}

And please don’t post code snippets. If you don’t know where the problem is, most likely it is not in the code you are showing us. Post a whole project or, if it is too large, a minimal but fully working example sketch that demonstrates the issue.

I do apologize for linking and not posting the entirety of my code here,

int RecieverPins[] = {2,4,7}; //Set what pins have been used to connect to the reciever in order of channel.
int OutputPins[] = {6,3,5};   //Set what pins to use to communicate to rc car.
int bindpin=8;
int passthrough=1;
#define LINE_BUF_SIZE 128
#define ARG_BUF_SIZE 64
#define MAX_NUM_ARGS 3
bool error_flag = false;

char line[LINE_BUF_SIZE];
char args[MAX_NUM_ARGS][ARG_BUF_SIZE];

//FUNCTIONS
int cmd_help(); //List the 5 commands
int cmd_passthrough(); //Enable passthrough
int cmd_bind();       //Toggle BIND mode on the reciever.
int cmd_read();
int cmd_write();
//List of functions for each command.
int (*commands_func[])(){
  &cmd_help,
  &cmd_passthrough,
  &cmd_bind,
  &cmd_read,
  &cmd_write
};

//COMMANDS
const char *commands_str[] = {
   "help",
   "passthrough",
   "bind",
   "read",
   "write"
};


//APPLICATION ARGUMENTS
const char *passthrough_args[] = {
   "on",
   "off"
};
const char *bind_args[] = {
   "on",
   "off"
};
int num_commands = sizeof(commands_str) / sizeof(char *);
//
//
//
//
//
//
//
//
//
//SETUP LOOP
void setup()
{
  for (int i=0; i<3; i++)
  {
    pinMode(RecieverPins[i], INPUT); //set reciever side pins as input to read PWM goodness.
  }
   pinMode(bindpin, OUTPUT);
   digitalWrite(bindpin, LOW);
   Serial.begin(115200);  
    cli_init();
}
//
//
//
//
//MAIN LOOP 
void loop() {
    RCcli();
    
}
//
//
//
//
//
//
//
void cli_init(){
    Serial.println("Device ready.");

}
 
 
void RCcli(){
    Serial.print("> ");
 
    read_line();
    if(!error_flag){
        parse_line();
    }
    if(!error_flag){
        execute();
    }
 
    memset(line, 0, LINE_BUF_SIZE);
    memset(args, 0, sizeof(args[0][0]) * MAX_NUM_ARGS * ARG_BUF_SIZE);
 
    error_flag = false;
}
void read_line(){
    String line_string;
 
    while(!Serial.available());
 
    if(Serial.available()){
        line_string = Serial.readStringUntil("\n");
        if(line_string.length() < LINE_BUF_SIZE){
          line_string.toCharArray(line, LINE_BUF_SIZE);
          Serial.println(line_string);
        }
        else{
          Serial.println("Invalid data.");
          error_flag = true;
        }
    }
}
 
void parse_line(){
    char *argument;
    int counter = 0;
 
    argument = strtok(line, " ");
 
    while((argument != NULL)){
        if(counter < MAX_NUM_ARGS){
            if(strlen(argument) < ARG_BUF_SIZE){
                strcpy(args[counter],argument);
                argument = strtok(NULL, " ");
                counter++;
            }
            else{
                Serial.println("Invalid data.");
                error_flag = true;
                break;
            }
        }
        else{
            break;
        }
    }
}
 
int execute(){  
    for(int i=0; i<num_commands; i++){
        if(strcmp(args[0], commands_str[i]) == 0){
            return(*commands_func[i])();
        }
    }
 
    Serial.println("Invalid command.");
    return 0;
}
int cmd_help(){
    if(args[1] == NULL){
        help_help();
    }
    else if(strcmp(args[1], commands_str[0]) == 0){
        help_help();
    }
    else if(strcmp(args[1], commands_str[1]) == 0){
        help_passthrough();
    }
    else if(strcmp(args[1], commands_str[2]) == 0){
        help_bind();
    }
    else if(strcmp(args[1], commands_str[3]) == 0){
        help_dataFunct();
    }
    else{
        help_help();
    }
}
 
void help_help(){
    Serial.println("Available commands:");
 
    for(int i=0; i<num_commands; i++){
        Serial.print("  ");
        Serial.println(commands_str[i]);
    }
    Serial.println("");
    Serial.println("Use \"help <command> \" for further details on a command.");
    Serial.println("Note: use of certain functions may take longer to process.");
}
 
void help_passthrough(){
    Serial.print("Sets the state of controller passthrough.\n");
    Serial.println("On: Controller passthrough enabled.\n");
    Serial.println("Off: controller passthrough disabled.\n");
    Serial.println("On by default\n");
}
void help_bind(){
    Serial.print("Sets BIND mode on or off.\n");
    Serial.println("On: sets BIND mode on.\n");
    Serial.println("Off: sets BIND mode off.\n");
}
void help_dataFunct(){
    Serial.print("Data command that allows read and writes on PWM channels.\n");
    Serial.println("read <channel> <PWM Value>\n");
    Serial.println("write <channel> <PWM Value>\n");
}
int cmd_passthrough(){
   if(strcmp(args[1], passthrough_args[0]) == 0){
        Serial.println("Passthrough on.");
        int passthrough=1;
    }
    else if(strcmp(args[1], passthrough_args[1]) == 0){
        Serial.println("Passthrough off.");
        int passthrough=0;
    }
}
int cmd_bind(){
   if(strcmp(args[1], bind_args[0]) == 0){
        Serial.println("Bind mode on");
        digitalWrite(bindpin, HIGH);
    }
    else if(strcmp(args[1], bind_args[1]) == 0){
        Serial.println("Bind mode off");
        digitalWrite(bindpin, LOW);
    }
}
int cmd_read(){
   int activePin = args[1];
   byte PWM_PIN = RecieverPins[activePin];
   int pwm_value;
   pwm_value = pulseIn(activePin, HIGH);
   Serial.println(pwm_value);
    }
int cmd_write(){
   int activePin = args[1];
   byte PWM_PIN = RecieverPins[activePin];
   int pwm_value_set = args[2];
   analogWrite(activePin, pwm_value_set);
   Serial.println(activePin, pwm_value_set);
}

args is a number or argument for a command (eg: on or off for some of the things I am working on implementing)
I was using this as a source for doing a serial command console
May I asks what you are referring to when you say 'element 1'?
How would I pass the pin index?

I get some compile warning pointing to possible errors. In two places you use a character pointer as if it were an integer. In several cases you declare a function that returns an 'int' value but you don't have a 'return value;' statement to specify the returned value.

/Users/john/Documents/Arduino/sketch_may10a/sketch_may10a.ino: In function 'void read_line()':
/Users/john/Documents/Arduino/sketch_may10a/sketch_may10a.ino:124:46: warning: invalid conversion from 'const char*' to 'char' [-fpermissive]
     line_string = Serial.readStringUntil("\n");        //////// USE '\n' INSTEAD OF "\n"
                                              ^
In file included from /Users/john/Library/Arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino/HardwareSerial.h:29:0,
                 from /Users/john/Library/Arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino/Arduino.h:233,
                 from sketch/sketch_may10a.ino.cpp:1:
/Users/john/Library/Arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino/Stream.h:108:10: note:   initializing argument 1 of 'String Stream::readStringUntil(char)'
   String readStringUntil(char terminator);
          ^~~~~~~~~~~~~~~
/Users/john/Documents/Arduino/sketch_may10a/sketch_may10a.ino: In function 'int cmd_help()':
/Users/john/Documents/Arduino/sketch_may10a/sketch_may10a.ino:208:1: warning: no return statement in function returning non-void [-Wreturn-type]
//////////////////// MISSING A RETURN STATEMENT /////////////
 }
 ^
/Users/john/Documents/Arduino/sketch_may10a/sketch_may10a.ino: In function 'int cmd_passthrough()':
/Users/john/Documents/Arduino/sketch_may10a/sketch_may10a.ino:248:9: warning: unused variable 'passthrough' [-Wunused-variable]
     int passthrough = 1;
         ^~~~~~~~~~~
/Users/john/Documents/Arduino/sketch_may10a/sketch_may10a.ino:253:9: warning: unused variable 'passthrough' [-Wunused-variable]
     int passthrough = 0;
         ^~~~~~~~~~~
/Users/john/Documents/Arduino/sketch_may10a/sketch_may10a.ino:255:1: warning: no return statement in function returning non-void [-Wreturn-type]
//////////////////// ANOTHER RETURN STATEMENT MISSING HERE ///////////////////
 }
 ^
/Users/john/Documents/Arduino/sketch_may10a/sketch_may10a.ino: In function 'int cmd_bind()':
/Users/john/Documents/Arduino/sketch_may10a/sketch_may10a.ino:268:1: warning: no return statement in function returning non-void [-Wreturn-type]
//////////////////// ANOTHER RETURN STATEMENT MISSING HERE ///////////////////

 }
 ^
/Users/john/Documents/Arduino/sketch_may10a/sketch_may10a.ino: In function 'int cmd_read()':
/Users/john/Documents/Arduino/sketch_may10a/sketch_may10a.ino:271:25: warning: invalid conversion from 'char*' to 'int' [-fpermissive]
   int activePin = args[1];  //////////////// DON'T USE A CHARACTER POINTER AS AN INTEGER
                         ^
/Users/john/Documents/Arduino/sketch_may10a/sketch_may10a.ino:272:8: warning: unused variable 'PWM_PIN' [-Wunused-variable]
   byte PWM_PIN = RecieverPins[activePin];   ///////////// YOU FORGOT TO USE THIS VARIABLE
        ^~~~~~~
/Users/john/Documents/Arduino/sketch_may10a/sketch_may10a.ino:276:1: warning: no return statement in function returning non-void [-Wreturn-type]
//////////////////// ANOTHER RETURN STATEMENT MISSING HERE ///////////////////

 }
 ^
/Users/john/Documents/Arduino/sketch_may10a/sketch_may10a.ino: In function 'int cmd_write()':
/Users/john/Documents/Arduino/sketch_may10a/sketch_may10a.ino:279:25: warning: invalid conversion from 'char*' to 'int' [-fpermissive]
   int activePin = args[1];  //////////////// DON'T USE A CHARACTER POINTER AS AN INTEGER
                         ^
/Users/john/Documents/Arduino/sketch_may10a/sketch_may10a.ino:281:29: warning: invalid conversion from 'char*' to 'int' [-fpermissive]
   int pwm_value_set = args[2];   //////////////// DON'T USE A CHARACTER POINTER AS AN INTEGER
                             ^
/Users/john/Documents/Arduino/sketch_may10a/sketch_may10a.ino:280:8: warning: unused variable 'PWM_PIN' [-Wunused-variable]
   byte PWM_PIN = RecieverPins[activePin];  ///////////// YOU FORGOT TO USE THIS VARIABLE
        ^~~~~~~
/Users/john/Documents/Arduino/sketch_may10a/sketch_may10a.ino:284:1: warning: no return statement in function returning non-void [-Wreturn-type]
//////////////////// ANOTHER RETURN STATEMENT MISSING HERE ///////////////////

 }
 ^
Sketch uses 5758 bytes (17%) of program storage space. Maximum is 32256 bytes.
Global variables use 1147 bytes (56%) of dynamic memory, leaving 901 bytes for local variables. Maximum is 2048 bytes.

Just making sure, as I don't program in c too much, sorry if these may be rudimentary questions.
If I use a 'byte' or 'int' in a function, I have to use a 'return' after my code but before the ending bracket?
Which value should I be returning?
It seems that arduino create doesn't complain.

/home/builder/opt/arduino-builder/arduino-builder -compile -core-api-version 10611 -hardware /home/builder/opt/arduino-builder/hardware -hardware /home/builder/.arduino15/packages -tools /home/builder/opt/arduino-builder/tools -tools /home/builder/.arduino15/packages -built-in-libraries/home/builder/opt/libraries/latest -logger humantags -fqbn arduino:avr:nano:cpu=atmega328old -build-cache /tmp -build-path /tmp/431755270/build -verbose -prefs runtime.tools.arduinoOTA.path=/home/builder/.arduino15/packages/arduino/tools/arduinoOTA/1.3.0 -prefs runtime.tools.avr-gcc.path=/home/builder/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5 -prefs runtime.tools.avrdude.path=/home/builder/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17 -prefs runtime.tools.esptool.path=/home/builder/.arduino15/packages/esp8266/tools/esptool/2.5.0-3-20ed2b9 -prefs runtime.tools.xtensa-lx106-elf-gcc.path=/home/builder/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9 -prefs runtime.tools.core2-32-poky-linux.path=/home/builder/.arduino15/packages/Intel/tools/core2-32-poky-linux/1.6.2+1.0 -prefs runtime.tools.openocd.path=/home/builder/.arduino15/packages/arduino/tools/openocd/0.10.0-arduino9 -prefs runtime.tools.arc-elf32.path=/home/builder/.arduino15/packages/Intel/tools/arc-elf32/1.6.9+1.0.1 -prefs runtime.tools.arduino101load.path=/home/builder/.arduino15/packages/Intel/tools/arduino101load/2.0.1 -prefs runtime.tools.CMSIS-Atmel.path=/home/builder/.arduino15/packages/arduino/tools/CMSIS-Atmel/1.2.0 -prefs runtime.tools.arm-linux-gcc.path=/home/builder/.arduino15/packages/arduino/tools/arm-linux-gcc/4.9.3 -prefs runtime.tools.arm-none-eabi-gcc.path=/home/builder/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4 -prefs runtime.tools.sketchUploader.path=/home/builder/.arduino15/packages/Intel/tools/sketchUploader/1.6.2+1.0 -prefs runtime.tools.flashpack.path=/home/builder/.arduino15/packages/Intel/tools/flashpack/2.0.0 -prefs runtime.tools.x86-linux-gcc.path=/home/builder/.arduino15/packages/arduino/tools/x86-linux-gcc/7.2.0 -prefs runtime.tools.dfu-util.path=/home/builder/.arduino15/packages/arduino/tools/dfu-util/0.9.0-arduino1 -prefs runtime.tools.linuxuploader.path=/home/builder/.arduino15/packages/arduino/tools/linuxuploader/1.5.1 -prefs runtime.tools.CMSIS.path=/home/builder/.arduino15/packages/arduino/tools/CMSIS/4.5.0 -prefs runtime.tools.mkspiffs.path=/home/builder/.arduino15/packages/esp8266/tools/mkspiffs/2.5.0-3-20ed2b9 -prefs runtime.tools.bossac.path=/home/builder/.arduino15/packages/arduino/tools/bossac/1.9.1-arduino1 -prefs runtime.tools.i586-poky-linux-uclibc.path=/home/builder/.arduino15/packages/Intel/tools/i586-poky-linux-uclibc/1.6.2+1.0 -prefs runtime.tools.nrf5x-cl-tools.path=/home/builder/.arduino15/packages/arduino/tools/nrf5x-cl-tools/9.3.1 -libraries /tmp/431755270/custom -libraries /tmp/431755270/pinned /tmp/431755270/Firmware

Using board 'nano' from platform in folder: /home/builder/.arduino15/packages/arduino/hardware/avr/1.8.2

Using core 'arduino' from platform in folder: /home/builder/.arduino15/packages/arduino/hardware/avr/1.8.2

Detecting libraries used...

/home/builder/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -I/home/builder/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/builder/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/eightanaloginputs /tmp/431755270/build/sketch/Firmware.ino.cpp -o /dev/null

Generating function prototypes...

/home/builder/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -I/home/builder/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/builder/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/eightanaloginputs /tmp/431755270/build/sketch/Firmware.ino.cpp -o /tmp/431755270/build/preproc/ctags_target_for_gcc_minus_e.cpp

/home/builder/opt/arduino-builder/tools/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /tmp/431755270/build/preproc/ctags_target_for_gcc_minus_e.cpp

Compiling sketch...

/home/builder/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -I/home/builder/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino -I/home/builder/.arduino15/packages/arduino/hardware/avr/1.8.2/variants/eightanaloginputs /tmp/431755270/build/sketch/Firmware.ino.cpp -o /tmp/431755270/build/sketch/Firmware.ino.cpp.o

Compiling libraries...

Compiling core...

Using precompiled core: /tmp/core/core_arduino_avr_nano_cpu_atmega328old_0fd389f0184d5a21fcc443ff311da7f1.a

Linking everything together...

/home/builder/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o /tmp/431755270/build/Firmware.ino.elf /tmp/431755270/build/sketch/Firmware.ino.cpp.o /tmp/431755270/build/../../core/core_arduino_avr_nano_cpu_atmega328old_0fd389f0184d5a21fcc443ff311da7f1.a -L/tmp/431755270/build -lm

/home/builder/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 /tmp/431755270/build/Firmware.ino.elf /tmp/431755270/build/Firmware.ino.eep

/home/builder/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-objcopy -O ihex -R .eeprom /tmp/431755270/build/Firmware.ino.elf /tmp/431755270/build/Firmware.ino.hex

/home/builder/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-size -A /tmp/431755270/build/Firmware.ino.elf

Sketch uses 5758 bytes (18%) of program storage space. Maximum is 30720 bytes.

Global variables use 1147 bytes (56%) of dynamic memory, leaving 901 bytes for local variables. Maximum is 2048 bytes.

Is there a better way to do this?

If you are not returning a value from a function, declare the return value 'void' (like setup() and loop()). Then you don't need a 'return' statement.

The "-w" option on the compile means "Inhibit all warning messages." Is there a place where you can set your warning level to "All" instead of "None"?

No, but it can be done through some script editing:
https://forum.arduino.cc/index.php?topic=46787.0

This is still nonsense if args[] is a character array...

 int activePin = args[1];

You cannot just convert a character array to an int like that.

Assuming that args[1] contains a pin index number i.e. “0”, “1” or “2” then use atoi function to get the integer value from the string.

This is what I think you were going for. I fixed the warning messages and added the conversion from ascii to integer. It seems to be parsing commands correctly:

Device ready.
> help
Available commands:
  help
  passthrough
  bind
  read
  write


Use "help <command> " for further details on a command.
Note: use of certain functions may take longer to process.
> help passthrough
Sets the state of controller passthrough.
On: Controller passthrough enabled.


Off: controller passthrough disabled.


On by default


> passthrough on
Passthrough on.
> passthrough off
Passthrough off.
> read 0
0
> read 1
0
> read 2
0
> write 0
0
> write 0 512
512
> write 1 256
256
> write 2 99
99
>
const byte RecieverPins[] = {2, 4, 7}; //Set what pins have been used to connect to the reciever in order of channel.
const byte OutputPins[] = {6, 3, 5}; //Set what pins to use to communicate to rc car.


const byte bindpin = 8;
boolean passthrough = true;
#define LINE_BUF_SIZE 128
#define ARG_BUF_SIZE 64
#define MAX_NUM_ARGS 3
bool error_flag = false;


char line[LINE_BUF_SIZE];
char args[MAX_NUM_ARGS][ARG_BUF_SIZE];


//FUNCTIONS
void cmd_help(); //List the 5 commands
void cmd_passthrough(); //Enable passthrough
void cmd_bind();       //Toggle BIND mode on the reciever.
void cmd_read();
void cmd_write();


//List of functions for each command.
void (*commands_func[])()
{
  cmd_help, cmd_passthrough, cmd_bind, cmd_read, cmd_write
};


//COMMANDS
const char *commands_str[] =
{
  "help", "passthrough", "bind",  "read", "write"
};




//APPLICATION ARGUMENTS
const char *passthrough_args[] =
{
  "on",  "off"
};


const char *bind_args[] =
{
  "on",  "off"
};


const int num_commands = sizeof commands_str / sizeof commands_str[0];
//
// SETUP LOOP
void setup()
{
  for (int i = 0; i < 3; i++)
  {
    pinMode(RecieverPins[i], INPUT); //set reciever side pins as input to read PWM goodness.
  }
  pinMode(bindpin, OUTPUT);
  digitalWrite(bindpin, LOW);
  Serial.begin(115200);
  cli_init();
}
//
//
//
//
//MAIN LOOP
void loop()
{
  RCcli();


}
//
//
//
//
//
//
//
void cli_init()
{
  Serial.println("Device ready.");


}




void RCcli()
{
  Serial.print("> ");


  read_line();
  if (!error_flag)
  {
    parse_line();
  }
  if (!error_flag)
  {
    execute();
  }


  memset(line, 0, LINE_BUF_SIZE);
  memset(args, 0, sizeof(args[0][0]) * MAX_NUM_ARGS * ARG_BUF_SIZE);


  error_flag = false;
}
void read_line()
{
  String line_string;


  while (!Serial.available());


  if (Serial.available())
  {
    line_string = Serial.readStringUntil('\n');
    if (line_string.length() < LINE_BUF_SIZE)
    {
      line_string.toCharArray(line, LINE_BUF_SIZE);
      Serial.println(line_string);
    }
    else
    {
      Serial.println("Invalid data.");
      error_flag = true;
    }
  }
}


void parse_line()
{
  char *argument;
  int counter = 0;


  argument = strtok(line, " ");


  while ((argument != NULL))
  {
    if (counter < MAX_NUM_ARGS)
    {
      if (strlen(argument) < ARG_BUF_SIZE)
      {
        strcpy(args[counter], argument);
        argument = strtok(NULL, " ");
        counter++;
      }
      else
      {
        Serial.println("Invalid data.");
        error_flag = true;
        break;
      }
    }
    else
    {
      break;
    }
  }
}


void execute()
{
  for (int i = 0; i < num_commands; i++)
  {
    if (strcmp(args[0], commands_str[i]) == 0)
    {
      (*commands_func[i])();
      return;
    }
  }


  Serial.println("Invalid command.");
  return;
}


void cmd_help()
{
  if (args[1] == NULL)
  {
    help_help();
  }
  else if (strcmp(args[1], commands_str[0]) == 0)
  {
    help_help();
  }
  else if (strcmp(args[1], commands_str[1]) == 0)
  {
    help_passthrough();
  }
  else if (strcmp(args[1], commands_str[2]) == 0)
  {
    help_bind();
  }
  else if (strcmp(args[1], commands_str[3]) == 0)
  {
    help_dataFunct();
  }
  else
  {
    help_help();
  }
}


void help_help()
{
  Serial.println("Available commands:");


  for (int i = 0; i < num_commands; i++)
  {
    Serial.print("  ");
    Serial.println(commands_str[i]);
  }
  Serial.println("");
  Serial.println("Use \"help <command> \" for further details on a command.");
  Serial.println("Note: use of certain functions may take longer to process.");
}


void help_passthrough()
{
  Serial.print("Sets the state of controller passthrough.\n");
  Serial.println("On: Controller passthrough enabled.\n");
  Serial.println("Off: controller passthrough disabled.\n");
  Serial.println("On by default\n");
}
void help_bind()
{
  Serial.print("Sets BIND mode on or off.\n");
  Serial.println("On: sets BIND mode on.\n");
  Serial.println("Off: sets BIND mode off.\n");
}
void help_dataFunct()
{
  Serial.print("Data command that allows read and writes on PWM channels.\n");
  Serial.println("read <channel> <PWM Value>\n");
  Serial.println("write <channel> <PWM Value>\n");
}


void cmd_passthrough()
{
  if (strcmp(args[1], passthrough_args[0]) == 0)
  {
    Serial.println("Passthrough on.");
    passthrough = true;
  }
  else if (strcmp(args[1], passthrough_args[1]) == 0)
  {
    Serial.println("Passthrough off.");
    passthrough = false;
  }
}


void cmd_bind()
{
  if (strcmp(args[1], bind_args[0]) == 0)
  {
    Serial.println("Bind mode on");
    digitalWrite(bindpin, HIGH);
  }
  else if (strcmp(args[1], bind_args[1]) == 0)
  {
    Serial.println("Bind mode off");
    digitalWrite(bindpin, LOW);
  }
}


void cmd_read()
{
  int channel = atoi(args[1]);
  unsigned long pwm_value = pulseIn(RecieverPins[channel], HIGH, 20000);
  Serial.println(pwm_value);
}


void cmd_write()
{
  int channel = atoi(args[1]);
  int pwm_value = atoi(args[2]);
  analogWrite(OutputPins[channel], pwm_value);
  Serial.println(pwm_value);
}

Now that I can see it in context, I see what is going on.
Thank you so much! This looked easier than some of the other methods I have found.