Trying to add in variable for API call

I am fairly new to coding and particle devices. In my code:

void setup() {
Particle.variable(“Power”, powerCheck.getHasPower);

void loop() {
if (millis() - lastCheck > 2000) {
lastCheck = millis();

	char buffer[256];
	snprintf(buffer, sizeof(buffer), "hasPower=%d hasBattery=%d isCharging=%d",
			powerCheck.getHasPower(), powerCheck.getHasBattery(), powerCheck.getIsCharging());

	if (strcmp(lastStatus, buffer) != 0) {
		strcpy(lastStatus, buffer);
		Particle.publish("battery", buffer, PRIVATE);


I get error 137:51: invalid use of non-static member function

I am trying to add in that I check power status via the api. I have bolded the code that i added. If I remove it it works fine. But I am really looking to call this function via an api call.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.