How to resolve this Ultrasonic :: timing error

When I compile my code gives this error 'unsigned int Ultrasonic :: timing ()' is private within this context
Can someone help me?

(deleted)

Sorry, follow more info

I'm using arduino Uno, my IDE version is at 1.8.10
Below is my code.

// --- Inclui a biblioteca da motor shield ---
#include <AFMotor.h>
// --- Inclui a biblioteca do Sensor Ultrasonico ---
#include <Ultrasonic.h>
// --- Inclui a biblioteca do Servo Motor ---
#include <Servo.h>
//========================================================================================
// --- Seleção dos Motores ---
AF_DCMotor motor1(1, MOTOR12_64KHZ); //Seleção do Motor 1
AF_DCMotor motor2(2, MOTOR12_64KHZ); //Seleção do Motor 2
//========================================================================================
// --

#define serv 10 //Controle do Servo 1

//Standard PWM DC control

//Declaração do Pinos dos Sensores
int Leftsensor = A5;
int Rightsensor = A4;

//Declaração do Pinos dos Sensores

int L_sensor_val = 0;
int R_sensor_val = 0;

int threshold = 700;

Servo servo_ultra_sonico;

float distancia;

int trigPin = A0;
int echoPin = A1;

Ultrasonic ultrasonic(trigPin, echoPin);

void setup(){

Serial.begin(9600);
//Serial.println("Começando...");

//servo_ultra_sonico.attach(10);

motor1.setSpeed(150);
motor2.setSpeed(150);

}

void loop() {

float cmMsec;
long microsec = ultrasonic.timing();

distancia = ultrasonic.convert(microsec, Ultrasonic::CM);

if(distancia < 10){
Serial.println("para");
motor1.run(RELEASE);
motor2.run(RELEASE);

return;
}

L_sensor_val = analogRead(Leftsensor);
R_sensor_val = analogRead(Rightsensor);
Serial.print("L = ");
Serial.print(L_sensor_val);
Serial.print(" R = ");
Serial.println(R_sensor_val);

if(L_sensor_val > threshold && R_sensor_val > threshold){
Serial.println("Girando pra esquerda - 1");
motor1.run(BACKWARD); //FORWARD
motor2.run(BACKWARD); //FORWARD
}

if(L_sensor_val < threshold && R_sensor_val < threshold){
Serial.println("ANDANDO PRA FRENTE");
motor1.run(FORWARD);
motor2.run(FORWARD);
delay (80);
}
//Sensor A5
if(L_sensor_val < threshold && R_sensor_val > threshold){
Serial.println("Girando pra Esquerda -Agora");
motor1.run(BACKWARD);
motor2.run(BACKWARD);
delay(150);
//motor1.run(RELEASE);
//delay (30);
motor2.run(BACKWARD);
delay (30);
motor2.run(FORWARD);
delay (100);
//motor1.run(BACKWARD);
//motor2.run(FORWARD);
}
//Sensor A4
if(L_sensor_val > threshold && R_sensor_val < threshold){
Serial.println("Girando pra Direita");
motor1.run(BACKWARD);
motor2.run(BACKWARD);
delay(50);
motor2.run(BACKWARD);
delay (30);
motor1.run(FORWARD);
delay (30);
//motor1.run(FORWARD);
//motor2.run(BACKWARD);
}
if(L_sensor_val == threshold && R_sensor_val == threshold){
Serial.println("Girando pra Esquerda -Dois LEDS");
motor1.run(RELEASE);
motor2.run(RELEASE);
delay(1000);
motor1.run(BACKWARD);
motor2.run(BACKWARD);
delay(350);
motor2.run(BACKWARD);
delay (30);
motor1.run(FORWARD);
delay (30);
//motor2.run(FORWARD);
//delay (30);
//motor1.run(FORWARD);
//motor2.run(FORWARD);
}

delay(10);
}

When I compile my code gives this error
'unsigned int Ultrasonic :: timing ()' is private within this contexto

Can someone help me?
I'm using arduino Uno, my IDE version is at 1.8.10
Below is my code.

// --- Inclui a biblioteca da motor shield ---
#include <AFMotor.h>
// --- Inclui a biblioteca do Sensor Ultrasonico ---
#include <Ultrasonic.h>
// --- Inclui a biblioteca do Servo Motor ---
#include <Servo.h>
//========================================================================================
// --- Seleção dos Motores ---
AF_DCMotor motor1(1, MOTOR12_64KHZ); //Seleção do Motor 1
AF_DCMotor motor2(2, MOTOR12_64KHZ); //Seleção do Motor 2
//========================================================================================
// --

#define serv 10 //Controle do Servo 1

//Standard PWM DC control

//Declaração do Pinos dos Sensores
int Leftsensor = A5;
int Rightsensor = A4;

//Declaração do Pinos dos Sensores

int L_sensor_val = 0;
int R_sensor_val = 0;

int threshold = 700;

Servo servo_ultra_sonico;

float distancia;

int trigPin = A0;
int echoPin = A1;

Ultrasonic ultrasonic(trigPin, echoPin);

void setup(){

Serial.begin(9600);
//Serial.println("Começando...");

//servo_ultra_sonico.attach(10);

motor1.setSpeed(150);
motor2.setSpeed(150);

}

void loop() {

float cmMsec;
long microsec = ultrasonic.timing();

distancia = ultrasonic.convert(microsec, Ultrasonic::CM);

if(distancia < 10){
Serial.println("para");
motor1.run(RELEASE);
motor2.run(RELEASE);

return;
}

L_sensor_val = analogRead(Leftsensor);
R_sensor_val = analogRead(Rightsensor);
Serial.print("L = ");
Serial.print(L_sensor_val);
Serial.print(" R = ");
Serial.println(R_sensor_val);

if(L_sensor_val > threshold && R_sensor_val > threshold){
Serial.println("Girando pra esquerda - 1");
motor1.run(BACKWARD); //FORWARD
motor2.run(BACKWARD); //FORWARD
}

if(L_sensor_val < threshold && R_sensor_val < threshold){
Serial.println("ANDANDO PRA FRENTE");
motor1.run(FORWARD);
motor2.run(FORWARD);
delay (80);
}
//Sensor A5
if(L_sensor_val < threshold && R_sensor_val > threshold){
Serial.println("Girando pra Esquerda -Agora");
motor1.run(BACKWARD);
motor2.run(BACKWARD);
delay(150);
//motor1.run(RELEASE);
//delay (30);
motor2.run(BACKWARD);
delay (30);
motor2.run(FORWARD);
delay (100);
//motor1.run(BACKWARD);
//motor2.run(FORWARD);
}
//Sensor A4
if(L_sensor_val > threshold && R_sensor_val < threshold){
Serial.println("Girando pra Direita");
motor1.run(BACKWARD);
motor2.run(BACKWARD);
delay(50);
motor2.run(BACKWARD);
delay (30);
motor1.run(FORWARD);
delay (30);
//motor1.run(FORWARD);
//motor2.run(BACKWARD);
}
if(L_sensor_val == threshold && R_sensor_val == threshold){
Serial.println("Girando pra Esquerda -Dois LEDS");
motor1.run(RELEASE);
motor2.run(RELEASE);
delay(1000);
motor1.run(BACKWARD);
motor2.run(BACKWARD);
delay(350);
motor2.run(BACKWARD);
delay (30);
motor1.run(FORWARD);
delay (30);
//motor2.run(FORWARD);
//delay (30);
//motor1.run(FORWARD);
//motor2.run(FORWARD);
}

delay(10);
}

Please READ THIS POST to help you get the best out of the forum.

SIMPLE TROUBLESHOOTING.

These steps may also save you some unnecessary time and effort in the forum.

COMMON ISSUES

  • Check you have a COMMON GROUND where required.

  • Where possible use USB 2.0 ports or a USB 2.0 POWERED HUB to rule out USB 3.0 issues.

  • Try other computers where possible.

  • Try other USB leads where possible.

  • You may not have the correct driver installed. CH340/341 or CP2102

  • There may be a problem with the board check your wiring first.

  • Remove any items connected to pins 0 and 1.
    COMPUTER RELATED

  • Ensure you turn off any additional security / antivirus just to test.

  • There may be a problem with the PC try RESTARTING it.

  • You may be selecting the wrong COM port.

  • Avoid cloud/network based installations where possible OR ensure your Network/Cloud software is RUNNING.

  • Clear your browsers CACHE.

  • Close the IDE before using any other serial programs.

  • Preferably install IDE's as ADMINISTRATOR or your OS equivalent
    Performing the above actions may help resolve your problem without further help.

Bob.

Please tell us where you got the library from. @spycatcher2k already asked for that.

What gave you the idea that you should call ultrasonic.timing() in your sketch? Are you basing your code on an example sketch?

I've merged your cross posts @paulohsantos19.

Cross posting is against the rules of the forum. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend 15 minutes writing a detailed answer on this thread, without knowing that someone else already did the same in the other thread.

Repeated cross posting will result in a suspension from the forum.

In the future, please take some time to pick the forum section that best suits the topic of your question and then only post once to that forum section. This is basic forum etiquette, as explained in the sticky "How to use this forum - please read." post you will find at the top of every forum section. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.