Pick a value from a wifi scan and use it after to compare

Hello!

I'm making a program for an autonomous robot to detect wifi networks and go to them. I'm new to this arduino and I'm pretty lost.

Basically what I find is that I need to choose a wifi from the scanner done. I am interested in the values ​​of the scanner of only one of the wifi that it detects. I know you have to do something with "val".

I need to be able to compare the two values ​​of a particular wifi to tell the robot where to go. To do this I have to know the value of the first and then compare it.

Does anyone know how it could be done?

Thank you very much

Your post was MOVED to its current location as it is more suitable.

We have no idea whet you mean by "val". Please post a complete sketch illustrating where you read the value of the val variable

the think is i don't know where to put the value, they told me by using val.

what i want is to safe a value from a wifi scan

Have you actually got a sketch ?

Who are "they" ?

my teachers. I'm working on the code but don't know how to continue

what do you mean by sketch?

Arduino programs are referred to as sketches

Post the program that you have so far. What exactly are you reading from WiFi ?

i'm using a esp32, and you have an example of Wifi Scan

This is my program so far

//s'inclou llibreria WiFi
#include "WiFi.h" 

//pins ultrasò
const int Trigger = 26;   
const int Echo = 25;  

//pins Motor A
int enableA = 34;
int motorA1 = 35;
int motorA2 = 32;

//pins Motor B
int enableB = 19;
int motorB1 = 5;
int motorB2 = 17;

*int ValorAnterior;*
*int ValorActual;*

void setup() {
 
  WiFi.mode(WIFI_STA);
  WiFi.disconnect();
  delay(100);

  pinMode(Trigger, OUTPUT); 
  pinMode(Echo, INPUT);  
  digitalWrite(Trigger, LOW);
   
  pinMode (enableA, OUTPUT);
  pinMode (motorA1, OUTPUT);
  pinMode (motorA2, OUTPUT);  
  
  pinMode (enableB, OUTPUT);
  pinMode (motorB1, OUTPUT);
  pinMode (motorB2, OUTPUT);  
  

}

void loop() {

//wifi scan 
 Serial.println("scan start");

    int n = WiFi.scanNetworks();
    Serial.println("scan done");
    if (n == 0) {
        Serial.println("no networks found");
    } else {
        Serial.print(n);
        Serial.println(" networks found");
        for (int i = 0; i < n; ++i) {
    
            Serial.print(i + 1);
            Serial.print(": ");
            Serial.print(WiFi.SSID(i));
            Serial.print(" (");
            Serial.print(WiFi.RSSI(i));
            Serial.print(")");
            Serial.println((WiFi.encryptionType(i) == WIFI_AUTH_OPEN)?" ":"*");
            delay(10);
        }
    }
    Serial.println("");


}

the int ValorActual... it's what i dont know

after, i want the value to compare from another wifi scan. This way for th robot to contiune or to turn to fins a better signal

i know i need a serial begin

Once I added a Serial.begin() to your sketch and commented out a couple of lines I got

scan start
scan done
7 networks found
1: PLUSNET_Moonraker (-37)*
2: DIRECT-E4-HP ENVY Photo 6200 (-46)*
3: BTHomeHub2-NMNR (-80)*
4: TALKTALKA69C25 (-84)*
5: TALKTALK8765E6 (-85)*
6: SKYBI7DY (-90)*
7: Zyxel_9A21 (-96)*

On the Serial monitor. What do you get and what do you want to do with the data ? I assume that you want to do something with the WiFi.RSSI() value

yes, let's say i want the value from PLUSNET_Moonraker. I need this value to compare it in another scan.

Start by posting an example of your output so that we can be sure that you have got the sketch working so far

I suspect that rather than wanting the RSSI value from a particular WiFi connection you want to know which is the strongest signal. Is that correct ?

My phone is iPhone de Nina and i need to keep the value, in this case -35. So, i will do another scan detect a value and then compare the two results so that the robot can turn around or go forward

This topic is a duplicate of Escoger una variable de un wifi scan - #4 by ninajubo

You cannot continue in both topics. Do you want to continue in English or Spanish ?

english, if you understand what i'm saying

I understand you so far.

Please ask a moderator in the Spanish section to close that topic

doesn't matter i continue in spanish
Thankyou!

OK

Good luck with your project