Issue with Libraries

Hi All,

We’re trying to write a library with multiple classes. Essentially, we want to declare different pin usage for different names. So, simply put, the code looks like:

#include “linebot.h”

linebot RSensor (10);
linebot LSensor (11);

void setup(){
}

void loop(){
}

This gives us an error during compiling. Tells me that RSensor is undeclared. Same with LSensor. I have included the .h and .cpp file in the ZIP attached. Can I do what I am trying to do ?

linebot.zip (700 Bytes)

You do not have a class called linebot. This code:

linebot::RSensor(int RS)
{
  pinMode(RS,INPUT);
  _RS = RS;
}


linebot::LSensor(int LS)
{
  pinMode(LS,INPUT);
  _LS = LS;
}

makes no sense.

The convention is that there is one class defined in a .h file, and implemented in a .cpp file, and that the name of the class is the same as the name of the file. You are violating all of these conventions, at your peril.