Nodemcu using timerone.h related issues

Currently using nodemcu for related research But there is an error message

error message as follows: Used: C: \ Users \ Lian \ Documents \ Arduino \ libraries \ TimerOne exit status 1 'class TimerOne' has no member named 'initialize'

The code is as follows: Timer1.initialize(4166.66); Timer1.attachInterrupt(timerIsr);

I have checked if the information can only be changed to ticker?

Is it because your using a float but the code expects an unsigned long?

Timer1.initialize(4166.66);

From Timer1 library

    void initialize(unsigned long microseconds=1000000) __attribute__((always_inline))

Yes timerOne is meant for avr boards, ticker works on ESP.

Deva_Rishi: Yes timerOne is meant for avr boards, ticker works on ESP.

Yes, Timer1 library only works for AVR & some ARM processors, not for ESP processors. It looks like to need to use the ticker library on the ESP but it seems to have some semi compatibility with timer1 (see here for examples)

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <SPI.h>
#include <Ticker.h>


float HeartbeatData;

byte serialA;
int A=0;
int B=0;

//-----------------------------------------------------------//
int inputpin0 = A0;
const int n1 = 4;
int data1[n1];           // all array data
int readIndex1 = 0;      // the index1 of the current reading

const int n2 = 256;
int data2[n2];           // all array data
int readIndex2 = 0;      // the index1 of the current reading
//-----------------------------------------------------------//

//WiFiClient
const char* ssid = "WIFI"; 
const char* password = "WIFI password";
char server[] = "IP";
WiFiClient client;


void setup()
{

    for (int i = 0; i < n1 ;i++) //0~4
  {
    data1[i] = 0;
    }
  for (int i = 0; i < n2 ;i++) //256
  {
    data2[i] = 0;
 }
 
  pinMode(A0,INPUT);
  Serial.begin(115200);
  delay(10);  
  timer1_write(4166);         
  timer1_attachInterrupt(timerIsr);
  
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);
 
  WiFi.begin(ssid, password);
 
  while (WiFi.status() != WL_CONNECTED) {
  delay(500);
  Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");

  Serial.println("Server started");
  Serial.print(WiFi.localIP());
  delay(1000);
  Serial.println("connecting...");
}


void loop() {
  
  Sending_To_phpmyadmindatabase(); 
  delay(5000);

  serialA=Serial.read();
  if (serialA == 78){    A=1;  }  
  if (serialA == 87){    A=0;  }
  
}

void timerIsr(){
   data1[readIndex1] = analogRead(inputpin0);                                            
   data2[readIndex2]=(data1[0]+data1[1]+data1[2]+data1[3])/4;
   readIndex2 = readIndex2 + 1;        
   if(readIndex2 >= n2 )
   {
    readIndex2 = 0;
    }                                          
   
   byte Data[6];
    B=B+1;
    Data[0]=data2[readIndex2]/256;
    Data[1]=data2[readIndex2]%256;

    if (A==1){
      if (B>=4){
      for(int j=0;j<6;j++)
     Serial.write(Data[j]);
      B=0;
      }
    }
   readIndex1 = readIndex1 + 1;     
   if(readIndex1 >= n1 )
   {
    readIndex1 = 0;
    }
    
} 

void Sending_To_phpmyadmindatabase()   //CONNECTING WITH MYSQL
 {
   if (client.connect(server, 80)) {
    Serial.println("connected");
    // Make a HTTP request:
    Serial.print("GET http://IP/dht.php?HeartbeatData=");
    client.print("GET http://IP/dht.php?HeartbeatData="); 
    
    Serial.println(HeartbeatData);
    client.print(HeartbeatData);
    
    client.print("&HeartbeatData=");
    Serial.println("&HeartbeatData=");
    
    client.print(" ");      //SPACE BEFORE HTTP/1.1
    client.print("HTTP/1.1");
    client.println();
    client.println("Host:IP");
    client.println("Connection: close");
    client.println();
  } else {
    // if you didn't get a connection to the server:
    Serial.println("connection failed");
  }
 }

Compiled without problems after changing to ticker
I would like to ask where it seems that the syntax is wrong or I want to modify
I am averaging data after doing ECG guide.
I am a newbie
thanks

Riva: Yes, Timer1 library only works for AVR & some ARM processors, not for ESP processors. It looks like to need to use the ticker library on the ESP but it seems to have some semi compatibility with timer1 (see here for examples)

Replaced with Ticker.h prove timer not applicable for esp