"" cannot be used as a function

I am trying to retrieve the RSSI value of the 4 closest Wifi network using my Node MCU 8266 board.
The goal is to: scan for Wifi networks. get the 4 best networks in an array. loop through the array and return each RSSI value in %, every second or so.

I get the following error (see below), what is wrong?

#include "ESP8266WiFi.h"

int nb_mapped =4;
int i =0;
void setup() {
 
  Serial.begin(115200);
 
  int numberOfNetworks = WiFi.scanNetworks();

 
}
 
void loop() {
  i = 0; 
   
  for(i; i<nb_mapped; i++){
 
   int map_sig = call(i);
    Serial.println(map_sig);
  }
  delay(5); 
  }


int call(i) {
  int best_rssi = -20;
  int worst_rssi = -70;

  int dBm = WiFi.RSSI(i);
 
  if (dBm <= worst_rssi)
    return 0;
  if (dBm >= best_rssi)
    return 255;
  return map(dBm, worst_rssi, best_rssi, 0, 255);
  }


... and the error i get 

Arduino: 1.8.19 (Mac OS X), TD: 1.56, Board: "NodeMCU 0.9 (ESP-12 Module), 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, 4MB (FS:2MB OTA:~1019KB), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

/var/folders/22/1k50_mf96zb686jpt40dnt2w0000gn/T/arduino_modified_sketch_240056/WiFiScan.ino: In function 'void loop()':
WiFiScan:19:24: error: 'call' cannot be used as a function
   19 |    int map_sig = call(i);
      |                        ^
/var/folders/22/1k50_mf96zb686jpt40dnt2w0000gn/T/arduino_modified_sketch_240056/WiFiScan.ino: At global scope:
WiFiScan:26:5: error: redefinition of 'int call'
   26 | int call(i) {
      |     ^~~~
/var/folders/22/1k50_mf96zb686jpt40dnt2w0000gn/T/arduino_modified_sketch_240056/WiFiScan.ino:26:5: note: 'int call' previously declared here
   26 | int call(i) {
      |     ^~~~
exit status 1
'call' cannot be used as a function

You have not specified the data type of the parameter in the function definition

int call(i)
{
etc, etc

Typically a function accepting input parameters wants to know the data types of the input parameters.

Such as

1.integer data type
2.character data type
3.float point data type
4.Boolean data type
5.void data type

example

int call ( int i ) or int call( i float ) or int call ( void i )

https://askatul.com/data-types-in-c-2/#:~:text=Types%20of%20data%20types%20in%20c%2B%2B%20%3A%201,pre-defined%20data%20types.%20...%204%20Boolean%20data%20type

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