Go Down

Topic: arduino handle with dictionary {key,value} please give examples. (Read 117 times) previous topic - next topic

rajesh1129

float n = WiFi.scanNetworks();

  Serial.printf("%d network(s) found\n", n);  //Scan start ... 5 network(s) found

  if (n == 0) {
    Serial.println("no wifi`s are connected");
  }
  else {
    int a[20];
    float array1[20];
    int j = 0;
            for (float i = 0; i < n; i++)
        {
          Serial.printf("%d: %d, Ch:%d (%ddBm)\n", i + 1, WiFi.SSID(i).c_str(), WiFi.channel(i), WiFi.RSSI(i));  //1: Tech_D005107, Ch:6 (-72dBm)
  }

  at this point i need to use dictionary
these are scanned networks

for(i=0;i<n;i++)

arr[n]={ssid:rssi,...,...,...,...n}

and i need to sort it.

and publish to local server or any server.




i need to publish
ssid,rssi of scanned network and ssid of my ESP

PaulS

Code: [Select]
            for (float i = 0; i < n; i++)
Why on earth are you using a float as the index into an array? Do you really expect to be able to get the 3.14159th element?

Quote
at this point i need to use dictionary
Why? A dictionary has key/value pairs, and uses dynamic memory allocation. What will your key be? What uniquely identifies an entry?

Quote
and i need to sort it
Based on?

Quote
and publish to local server or any server
How do you plan to do this?
The art of getting good answers lies in asking good questions.

Go Up