conectar

Conectar a Red Wi-Fi

Si no has leído el artículo anterior te recomiendo que lo hagas ya que en este vamos a conectar a una red que el NodeMCU haya detectado y para esto debemos escanear redes, esta demostración se encuentra en el artículo anterior.

Artículo anterior: https://ciber-tips.juegazos.net/escaner-redes-wifi/

Para conectar a una red lo vamos a ver de diferentes formas: la primera es escanear y conectarte a la primera red que encuentre existiendo dos posibilidades que tenga contraseña o no, y la segunda poniendo un SSID estático, por lo que siempre se va a conectar a la misma red.

conectar

Conectar con escáner:

Ejemplo 1:

Comenzamos con la primera opción y es escanear redes y que se conecte a la primera que encuentre suponiendo que esta no tenga contraseña. Para esto vamos al proyecto que habíamos hecho en el video anterior y escribimos en el void loop antes del delay wi-fi.begin (WiFi.SSID(0)).

#include "ESP8266WiFi.h"

void setup() {

  Serial.begin(9600);

  
  WiFi.mode(WIFI_STA);
  WiFi.disconnect();
}

void loop() {

  Serial.println("Escaneando...");

  int n = WiFi.scanNetworks();
  Serial.println("Escaner terminado");

  if (n == 0) {
    Serial.println("No se encontraron redes");
  }
 
  else {
    Serial.print(n);
    Serial.println(": Redes encontradas");

    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) == ENC_TYPE_NONE) ? " " : "*");
      delay(10);
    }
  }
WiFi.begin(WiFi.SSID(0));

  Serial.println("Conectado a red 1");
  delay(5000);
}

Ejemplo 2:

En el segundo caso la diferencia es que vamos a colocar después del SSID una coma y seguido la contraseña.

#include "ESP8266WiFi.h"

void setup() {

  Serial.begin(9600);

  
  WiFi.mode(WIFI_STA);
  WiFi.disconnect();
}

void loop() {

  Serial.println("Escaneando...");

  int n = WiFi.scanNetworks();
  Serial.println("Escaner terminado");

  if (n == 0) {
    Serial.println("No se encontraron redes");
  }
 
  else {
    Serial.print(n);
    Serial.println(": Redes encontradas");

    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) == ENC_TYPE_NONE) ? " " : "*");
      delay(10);
    }
  }
WiFi.begin(WiFi.SSID(0),"12345678");

  Serial.println("Conectado a red 1");
  delay(5000);
}

Conectar con SSID estático

Ejemplo 1:

En el tercer caso voy a decirle al NodeMCU que se conecte a una red especifica que no tenga contraseña. Para esto voy barrar todo el proceso de escáner de redes y declaro una variable a la cual le voy a poner el SSID de la red que quiero que se conecte. En el setup dejamos la configuración del modo estación y en el loop ponemos WiFi.begin(en la variable que guardamos el SSID).

#include "ESP8266WiFi.h"
const char* ssid = "CiberTips";
void setup() {
  Serial.begin(9600);

  WiFi.mode(WIFI_STA);
  WiFi.disconnect();
}

void loop() {

  WiFi.begin(ssid);
  Serial.println("Se conectó a ");
  Serial.println("CiberTips");
  Serial.print("");
  delay(10000);
}

Ejemplo 2:

En el cuarto caso voy a decirle al NodeMCU que se conecte a una red especifica con contraseña. Para esto es el mismo proceso del tercer caso, pero incluyendo una variable donde guardamos la contraseña y en el loop lo que hacemos es incluir la variable de la contraseña después del SSID.

#include "ESP8266WiFi.h"
const char* ssid = "CiberTips";
const char*  = "12345678";
void setup() {
  Serial.begin(9600);

  WiFi.mode(WIFI_STA);
  WiFi.disconnect();
}

void loop() {

  WiFi.begin(ssid,);
  Serial.println("Se conectó a ");
  Serial.println("CiberTips");
  Serial.print("");
  delay(10000);
}

Descarga el IDE Arduino: https://www.arduino.cc/en/main/software

2 comentarios en “Conectar a Red Wi-Fi”

  1. We will examine how iconic figures like Arnold Schwarzenegger and Ronnie Coleman may need approached their cycles,
    acknowledging the era-specific contexts of steroid use.
    Arnold Schwarzenegger, a reputation synonymous with bodybuilding,
    is clear about his use of Dianabol during his reign in the bodybuilding enviornment.
    He hails from a time when Dbol utilization was authorized and
    generally condoned, mirroring the situation we see
    today. Comparable to 7-KETO DHEA, B-AET doesn’t suppress the HPTA and promotes fats loss by inhibiting cortisol.
    Primarily Based on personal experience, B-AET presents superior outcomes in comparability
    with 7-KETO DHEA.
    As A Substitute of ready for their muscles to alter first, customers are capable of instantly see and really
    feel the change of their stamina and power levels brought on by
    the supplement. Bodybuilders have to weigh the great towards
    the unhealthy, pondering fastidiously about their well being and goals.
    Essential recommendation includes often checking
    your well being to ensure security. The goal is to use steroids safely to get the best outcomes without risking your Health effects of Steroids.

    Buy from legit on-line retail retailers just like the official web site of
    CrazyBulk that promote legal different steroids such
    as D-Bal, Deca Max, and Testo-Max. At All Times attempt to be
    steroid-free and supply product star rankings in order to
    be real. It is made with natural ingredients that
    mimic the effects of Deca with none of the unwanted side effects.

    These reasons and more are why we wouldn’t advocate any
    of our readers to take Deca Durabolin. Especially when there’s a a lot safer,
    healthier, and authorized substitute available for each men and women. If you expertise any of those unwanted aspect effects, you
    will need to discontinue use and consult your doctor before it turns into something more serious.
    Deca can be toxic to the liver, so it may be very important use it
    responsibly and beneath the supervision of a medical skilled.

    An important side to consider when using the injections is
    determining the suitable cycle and dosage. As beforehand talked about, cycles can range from 8-12 weeks, with dosages various primarily based on individual wants and
    experience ranges. This is why you want to take medication to keep your hormone ranges
    balanced, produce enough testosterone to keep functioning
    normally. If you don’t, you’ll find a way to lose the
    entire gains you’ve made during the cycle and/or develop side-effects like gynecomastia, erectile dysfunction and different
    circumstances. There are a number of methods to make use of Deca, many favor injections as a
    outcome of the effects are a lot faster, however you need to use tablets also without a lot distinction.
    Avoiding processed meals and sugary snacks can also assist to maximize the benefits of the
    Winstrol cycle. Greatest for women and newbies, resulting in muscle achieve with fewer unwanted aspect effects.
    Low anabolic activity with few unwanted effects,
    excellent for individuals in search of safe and efficient gains.
    A typical dosage for ladies is round 50mg per week, although some may have to use barely roughly relying on their particular person needs.

    It is essential to start out off with the bottom possible dosage and
    progressively increase it till desired outcomes are achieved.

    Staying well-hydrated and maintaining a balanced diet wealthy in important vitamins
    like omega-3 fatty acids, glucosamine, and chondroitin can t health.
    Oral steroids are available pill or capsule kind, making them convenient and easy to use.

    Nevertheless, they are metabolized by the liver, which can result in strain on this organ if not used responsibly.
    Finest for bulking and recovery, especially when combined with testosterone.

    As with all anabolic steroids, Deca-Durabolin should be used
    at your individual danger. It’s essential to emphasize that proper cycle length,
    dosage, and post-cycle therapy (PCT) are important when stacking Deca-Durabolin with any
    compound. A typical cycle length ranges from eight to 12 weeks, with dosages various based mostly
    on expertise stage and specific goals. Additionally, implementing an efficient PCT
    protocol is crucial to help restore pure hormone manufacturing and maintain gains after the cycle.
    Nandrolone Decanoate can be stacked with different compounds to boost its effects.
    For instance, it’s often mixed with testosterone for a synergistic impact on muscle growth and power.

    If you’re a steroid consumer than you understand that
    after a spherical of steroid consumption need to be taken a pause to let the physique
    functions return to normal.
    Such individuals commonly don’t have any desire to construct any new lean muscle mass, however the aid alone is invaluable.
    A slightly higher dose will provide reduction, tremendously enhance general restoration, and
    improve muscular endurance. When it involves efficiency enhancement, most athletes will discover this steroid is hard to beat.

    Such painkillers only masks the ache, whereas Deca Durabolin can truly
    heal the body. This steroid escalates nitrogen retention within muscle
    tissues, fostering an optimal state for accelerated muscle growth and restore.

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Top arrow