My Library Is Not Working!

I am trying to make a library which will make my complicated code easier to read and make new programs out of. But when I verify my library, it throws up an error:

exit status 1
request for member 'Listen123' in 'robocar123', which is of non-class type 'Robocar()'

Can anybody help?

I've probably done something really dumb, but for the life of me I can't figure it out.

Robocar.cpp (3.93 KB)

Robocar.h (406 Bytes)

Sounds like your sketch has declared something wrong. What does your sketch say? What is the full error message?

This is what I get when I try to include your library in the minimal sketch:

In file included from /Users/john/Documents/Arduino/sketch_sep11b/sketch_sep11b.ino:1:0:
/Users/john/Documents/Arduino/libraries/Robocar/Robocar.h:4:20: fatal error: EasyVR.h: No such file or directory
 #include <EasyVR.h>
                    ^
compilation terminated.
exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

Reedsmout:
class Robocar {
public:
void Setup();
void Listen();

Methods and variables conventionally start with a lowercase letter, types start with an uppercase.

If your "listen" method does what I think it does, I usually call that method "loop()" because arduino programmers are probably familiar with the idea.

It's a good idea to bracket your debugging output with

#ifdef DEBUG
  Serial.println(:my debigging");
#endif

and to #define DEBUG at the top of the .h file.

But as to your bug: the class "Robocar" does not have a method named "Listen123". If you have a variable of type Robocar named robocar123, then you invoke its listen method as robocar123.Listen().

Your library compiles fine (only one warning) with this sketch:

#include "Robocar.h"

Robocar robocar123;

void setup() {
  // put your setup code here, to run once:
  robocar123.Setup();
}

void loop() {
  // put your main code here, to run repeatedly:
  robocar123.Listen();
}

The warning is:

/Applications/Arduino 1.6.10.app/Contents/Java/libraries/Servo/src/avr/Servo.cpp:184:39: warning: unused parameter 'timer' [-Wunused-parameter]
 static void finISR(timer16_Sequence_t timer)
                                       ^

If that function is used as an ISR it should have no arguments.

Thanks for that everyone, It turns out I solved it with different methods, but thanks for all the help!

Reedsmout:
I am trying to make a library which will make my complicated code easier to read and make new programs out of. But when I verify my library, it throws up an error:

exit status 1

request for member 'Listen123' in 'robocar123', which is of non-class type 'Robocar()'




Can anybody help?

I've probably done something really dumb, but for the life of me I can't figure it out.

Nope nothing dumb about it , the compiler message is coded - it means - there is no member named Listen123.
Do "find" for "listen" with "ignore case" option to find the offender.