Module 3.1.1 The Arduino Command Line.

I tried to compile the example code in this tutorial, but run into the following error:

" 'cmdHello' was not declared in this scope"

My code is below"

#include <cmdArduino.h>
void setup() {
  // put your setup code here, to run once:
  cmd.begin(57600);
  // Initializes serial port and structures needed bt the command line.
  //Similar ro Serial.begin(baudrate)

  cmd.add("Hello", cmdHello);
  //adds a new command to the command line
  // the command list is the list of command functions we create

}

void loop() {
  // put your main code here, to run repeatedly:
cmd.poll();
//Checks the serial port tosee if a command keyword has been typed into the monitor
// Check checks if keyword mthces a command specified in the command list
// If there's a match, cmd.poll() calls the function specified for that command keyword.
// Case sensitive: Hello and hello are different

}

void cmdFunctionName(int argCnt, char**args){
  Serial.println("Hello Command line");
 
 
}

Can anyone help me find a solution?




Hey there,

After the loop function, if you change the function name from cmdFunctionName to cmdHello, it will work. 

Basically, in the setup loop, when you add a command, you add a keyword (eg."hello"), and the function (eg. cmdHello) that we want cmd.poll() to call when it sees that keyword has been typed into the console. 

At the moment, there is no function called cmdHello, hence the error. 

hope that helps!

Jacinta

 

thanks jacinta. it worked again. The problem was I couldnt exactly see How yall set up the serial monito in the video, because all the links to future videos actually covered the bottom that showed that part. Sorry about that.