Ok so this is a common error, yet I'm unable to understand why this is happening in the program, follow the example :
Arduino Sketch
#include <Arduino.h>
#include <string.h>
#include "Thread.h"
#include "ThreadController.h"
[b]#include <Classe_Indice.h>[/b]
[b]#include <Programas.h>[/b]
Classe_Indice *indice = new Classe_Indice(); // this pointer to object will acess the non-static //methods, it is a global one.
ThreadController cpu;
Programas programacao = Programas();
void setup() {
programacao.setInterval(200);
programacao.onRun(indice->verificaProgramacao);
cpu.add(&programacao);
}
void loop () {
cpu.run()
}
Classe_Indice.h
#ifndef CLASSE_INDICE
#define CLASSE_INDICE
#include <Arduino.h>
class Classe_Indice {
public : int incrementaEvento;
int incrementaFert;
void setNumeroEvento(int numeroEvento);
int getNumeroEvento();
void setNumeroFert(int numeroFert);
int getNumeroFert();
private : int numeroEvento;
int numeroFert;
};
#endif
Classe_Indice.cpp
/*
* Method Name : incrementaFert
*
* Synopsis : int Classe_Indice::incrementaFert() *
* Description : Método que incrementa a variável de indice numeroFert.
*
*/
int Classe_Indice::incrementaFert(){
numeroFert++;
}
/*
* Method Name : setNumeroFert
*
* Synopsis : void Classe_Indice::setNumeroFert(int numeroFert) *
* Description : Método set da variavel de indice numeroFert.
*
*/
void Classe_Indice::setNumeroFert(int numeroFert){
_numeroFert = numeroFert;
}
/*
* Method Name : getNumeroFert
*
* Synopsis : int Classe_Indice::getNumeroFert() *
* Description : Método get da variavel de indice numeroFert.
*
*/
int Classe_Indice::getNumeroFert(){
return _numeroFert;
}
/*
* Method Name : incrementaEvento
*
* Synopsis : int Classe_Indice::incrementaEvento() *
* Description : Método que incrementa a variável de indice numeroEvento.
*
*/
int Classe_Indice::incrementaEvento(){
numeroEvento++;
}
/*
* Method Name : setNumeroEvento
*
* Synopsis : void Classe_Indice::setNumeroEvento(int numeroEvento) *
* Description : Método set da variável de indice numeroEvento.
*
*/
void Classe_Indice::setNumeroEvento(int numeroEvento){
_numeroEvento = numeroEvento;
}
/*
* Method Name : getNumeroEvento
*
* Synopsis : int Classe_Indice::getNumeroEvento() *
* Description : Método set da variável de indice numeroEvento.
*
*/
int Classe_Indice::getNumeroEvento(){
return _numeroEvento;
}
Programas.h
#ifndef PROGRAMAS_H
#define PROGRAMAS_H
/*Biblioteca padrão do Arduino*/
#include <Arduino.h>
/*Biblioteca de Threads*/
#include "Thread.h"
#include "ThreadController.h"
/* Bibliotecas de data/hora para módulo DS1307 RTC */
#include <Wire.h>
#include <RTClib.h>
#include <Time.h>
#include <TimeLib.h>
#include <TimeAlarms.h>
/*Biblioteca de Lista Encadeada*/
#include <LinkedList.h>
#include <Classe_Indice.h>
#include <Fertilizantes.h>
#include <Eventos.h>
#include <Agendamentos.h>
#include <RecuperaIrriga.h.>
#include <RecuperaFerti.h>
class Programas: public Thread
{
public : bool shouldRun();
void verificaProgramacao();
private : unsigned long tempo;
DateTime now;
};
#endif
Programas.cpp
#include <Programas.h>
extern LinkedList<Agendamentos*> agendamentos;
extern Programas programacao;
extern RecuperaIrriga thread_prepara_irriga;
extern RecuperaFerti thread_prepara_ferti;
extern RTC_DS1307 rtc;
/*
* Method Name : shouldRun
*
* Synopsis : bool Programas::shouldRun() *
* Description : Método que avalia se a Thread deve ser iniciada.
*
*/
bool Programas::shouldRun(){
unsigned long tempo = 0;
DateTime now = rtc.now();
if (millis() >= 500){
if(agendamentos.size() > 0){
if(((now.dayOfTheWeek()*86400)+(now.hour()*3600)+(now.minute()*60)+(now.second())) == (agendamentos.get(0)->getDia()*86400)+(agendamentos.get(0)->getHora()*3600)+(agendamentos.get(0)->getMinuto()*60)+(agendamentos.get(0)->getSegundo())){
programacao.run();
return true;
}
else {
return false;
}
}else{
tempo = millis();
}
}
}
/*
* Method Name : verificaProgramacao
*
* Synopsis : void Programas::verificaProgramacao() *
* Description : Método que inicia a thread e executa suas instruções.
*
*/
void Programas::verificaProgramacao(){
Classe_Indice::numeroEvento = 0;
indice->setNumeroEvento(numeroEvento);
if (agendamentos.get(0)->getEvento(indice->getNumeroEvento())->sizeFertilizantes() == '0'){
// Irrigacao?
programacao.enabled = false;
thread_prepara_irriga.enabled = true;
} else {
// E fertirrigacao?
programacao.enabled = false;
thread_prepara_ferti.enabled = true;
}
}
error: 'class Classe_Indice' has no member named 'verificaProgramacao', note that Programas.h has #include <Classe_Indice.h>, why this is happening? Thanks