Node MCU and ThinSpeak not compiling

I will to make small project for water counter remote reading. Based on Node mcu board and one reed switch as sensor to read. data will send to Thingspeak server.
without thingspeak command all work,

after code verify error:
57 | ThingSpeak.begin(Client);
| ^
exit status 1
expected primary-expression before ')' token


#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ThingSpeak.h>

uint8_t GPIO_Pin = D2;                                // Sensora PIN
float counter;                                  // impulsu skaits 5 min
float Vol1;                                      // patēriņš litros 5 min
float Vol2;                                      // patēriņš litros 1h
float Vol3;                             // patēriņš kopā m3
unsigned int myTimer1, myTimer2;                      // data send time interval 
unsigned long myChannelNumber = XXXXXXX;                 // Thingspeak channel ID here  
const char * myWriteAPIKey = "xxxxxx";                            // Write API key here PWQFPRFHLDC6QPT7
const char * myReadAPIKey ="xxxxxxx";           // Read API Key 
const char* ssid     = "MikroTik";                      // SSID of wireless network
const char* password = "XXXXX";                      // Password for wireless network


int status = WL_IDLE_STATUS;
//WiFiClient  client;

void setup() {
Serial.begin(115200);

pinMode(D2, INPUT_PULLUP);

 WiFi.mode(WIFI_STA);
 WiFi.begin(ssid, password);
 
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());

  while (WiFi.status() != WL_CONNECTED) {
    delay(5000);
    Serial.print(".");
    WiFi.mode(WIFI_STA);   // Start the server
}
  
  //ThingSpeak.begin(Client);
 
 Serial.print("");
  Serial.print("WiFi connected"); 
 Serial.print("IP address: ");
 Serial.println(WiFi.localIP());
 Serial.print("IP address: ");
  pinMode(D2, INPUT_PULLUP);           // Button D2 and GND
  attachInterrupt(digitalPinToInterrupt(GPIO_Pin), btnIsr, RISING);   //attachInterrupt(0, btnIsr, RISING); 
 
 
 Vol1 = ThingSpeak.readLongField( myChannelNumber, 1, myReadAPIKey );
 Vol2 = ThingSpeak.readLongField( myChannelNumber, 2 , myReadAPIKey );
 Vol3 = ThingSpeak.readLongField( myChannelNumber, 3 , myReadAPIKey );
 // Vol3 = ThingSpeak.readLongField( myChannelNumber, 3 , myReadAPIKey );
 //ThingSpeak.begin(Client) ;  // jjhlk ThingSpeak.begin(Client).hhgkjkj 
}
volatile uint32_t debounce;
 IRAM_ATTR void btnIsr() {
   
  if (millis() - debounce >= 100 && digitalRead(2)) {
    debounce = millis();
    counter++;  
          }
}
    
  void datasend1(){
    ThingSpeak.writeField(myChannelNumber,1,Vol1, myWriteAPIKey);
    ThingSpeak.writeField(myChannelNumber,3,Vol3/1000, myWriteAPIKey);
    
    
    Serial.print("time1");
    Serial.print("==impulse counter==");
    Serial.println(counter);
    Serial.print("");
    Serial.print("Liter 5 min -- ");
    Serial.println(Vol1);
    Serial.print("");

    counter=0;
    Vol1=0;
    }
    
  void datasend2() {
    
    ThingSpeak.writeField(myChannelNumber, 2, Vol2, myWriteAPIKey);
        
    Serial.print("");
    Serial.print("Litri 60 min-- ");
    Serial.println(Vol2);
    Serial.print("");
    Serial.print("Kubi kopā"); 
    Serial.println(Vol3);
    Serial.println(Vol3/1000);
    Serial.print("");
    //Serial.print("");
    Vol2=0;
    }

void loop() {
      
  if (millis() - myTimer1 >=30*1000) {   // minūtē
    Vol1=float(counter*10) ;                        // patēriņš 1 min
    Vol2=Vol2+Vol1;                            // stundā
    Vol3=Vol3+float(counter/100);                           //kopā                            
    myTimer1 = millis();              
    datasend1();
  }
  else {
    if (millis() - myTimer2 >=60*1000) {   // stundā
    myTimer2 = millis();              
    Vol2=0 ;                        // 60 min patēriņš litros
                     
    datasend2();
  }
  }
}

You defined wifi object instance as "client"

WiFiClient  client;

but using it as "Client"

ThingSpeak.begin(Client);

Objects, variables and procedure names are case sensitive in C/C++

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