The files and compiler result follow. Where is my error??
I have a sub-dir inside libraries named uStimer. This sub-dir contains two files named uStimer.h and uStimer. cpp I use a Mega 2560 that compiles sketches normally but not this one. the
HERE IS THE .H FILE
#ifndef USTIMER_H
#define USTIMER_H
#include <Arduino.h>
class uStimer {
private:
unsigned long uSvalue; //SANS = 0
public:
void start();
bool counting(unsigned long len);
unsigned long see();
};
#endif
HERE IS THE .CPP FILE
#include "uStimer.h"
#include <Arduino.h>
unsigned long uSvalue = 0;
void start() {
uSvalue = micros();
}
bool counting(unsigned long len) {
if (micros() - uSvalue >= len ) {
return false;
}
return true;
}
unsigned long see() {
return (micros() - uSvalue);
}
HERE IS THE .INO FILE
#include <uStimer.h>
uStimer chrono; //NO COMPILER ERROR HERE
//------------------------------------------------------------
void setup() {
Serial.begin(9600);
delay(1000);
}
//------------------------------------------------------------
void loop() {
chrono.start(); //COMPILER ERROR: SEE BELOW
}
//------------------------------------------------------------
HERE IS THE COMPILER OUTPUT
Arduino: 1.8.19 (Windows 10), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"
C:\Users\Serge\AppData\Local\Temp\ccnpib94.ltrans0.ltrans.o: In function `loop':
C:\Users\Serge\Documents\Arduino\Sketches\testLibrary/testLibrary.ino:11: undefined reference to `uStimer::start()'
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino Mega or Mega 2560.