Hi all. I have been pulling my hair out trying to fix this error. I manage to fix all but this error:
"no instance of overloaded function "mbed::Ticker::attach" matches the argument list" in file "cfExtensionscfExtensions.cpp", Line: 69, Col: 37
in my main.cpp file I have:
#include "mbed.h"
#include "MODSERIAL.h"
#include "msExtensions.h"
#include "cfExtensions.h"
MODSERIAL pc(USBTX, USBRX);
msExtensions msAccess(&pc);
cfExtensions cfAccess(&msAccess);
int main()
{
while(1) {
}
}
In my cfExtensions.cpp file where that error resides:
void cfExtensions::checkConfigForFirstStart() {
/*
* Get a configuration value.
*/
if (_cfg.getValue(cfExtensions::sbFirstStartKey, &cfExtensions::sbFirstStartValue[0], sizeof(cfExtensions::sbFirstStartValue))) {
if (strcmp(&cfExtensions::sbFirstStartValue[0], "TRUE") == 0) {
//someText = "PING!";
//_msAccess->sendSomething(sbNameValue);
pingTick.attach(&_msAccess, &_msAccess->sendSomething(cfExtensions::sbNameValue), 10);
while(!_pc->readable()) {
if (cfExtensions::pingTicked) {
cfExtensions::pingTicked = false;
}
}
if(_pc->readable()) {
pingTick.detach();
}
_cfg.setValue("FirstStart", "FALSE");
_cfg.write("/local/settings.cfg");
}
}
} // End of checkConfigForFirstStart
<</code>
The sendSomething method resides in msExtensions.cpp file:
<<code>>
void msExtensions::sendSomething(char* txt) {
printf("{\"sbPing\": \"%s\"}\r\n", txt);
} // End of pingBaseStation function
<</code>>
I have included the appropriate header files in both csExtensions and msExtensions classes. I did instantiate the Ticker object in the cfExtensions.h file like so:
<<code>>
public:
//---------------------------
// Declare Public Functions
//---------------------------
Ticker pingTick; //Declare Ticker object
In regards to the Ticker object, I am not exactly sure if that is a good place to instantiate the pingTick object. I did read the Ticker api, but am still a bit rusty at understanding the api. I also read the section about how to use the method within a class, which lead me to the code that I wrote. The method code example shows & next to the address of the object and the member function. When I incorporated the & I arrived at another error: "expression must be an lvalue or a function designator" in file "cfExtensionscfExtensions.cpp", Line: 69, Col: 41. That error I believe was thrown due to code: &_msAccess->sendSomething(cfExtensions::sbNameValue). I am now ultimately confused. How do I fix my coding error so Ticker works effectively?
Hi all. I have been pulling my hair out trying to fix this error. I manage to fix all but this error:
"no instance of overloaded function "mbed::Ticker::attach" matches the argument list" in file "cfExtensionscfExtensions.cpp", Line: 69, Col: 37
in my main.cpp file I have:
In my cfExtensions.cpp file where that error resides:
In regards to the Ticker object, I am not exactly sure if that is a good place to instantiate the pingTick object. I did read the Ticker api, but am still a bit rusty at understanding the api. I also read the section about how to use the method within a class, which lead me to the code that I wrote. The method code example shows & next to the address of the object and the member function. When I incorporated the & I arrived at another error: "expression must be an lvalue or a function designator" in file "cfExtensionscfExtensions.cpp", Line: 69, Col: 41. That error I believe was thrown due to code: &_msAccess->sendSomething(cfExtensions::sbNameValue). I am now ultimately confused. How do I fix my coding error so Ticker works effectively?