Station connection
Posted:
Tue Jun 23, 2020 5:59 pm
by PALCAL
Hi, I am new to ESP Basic but have a background in Micromites. I have flashed my module and connected in AP mode. On the Settings page I entered my Sation ID and password but where do I find the IP address to connect to. I opened a terminal but all I saw was gibberish.
Re: Station connection
Posted:
Thu Jun 25, 2020 4:25 am
by AcmeUK
I opened a terminal but all I saw was gibberish.
Perhaps the 'gibberish' was boot messages at 74880 baud giving information as to why your sketch is not working!
See here:-
https://www.esp8266.com/viewtopic.php?f=160&t=12635
Re: Station connection
Posted:
Wed Aug 26, 2020 6:38 am
by Gabby Emanuel
#include <ESP8266WiFi.h> // Include the Wi-Fi library
const char* ssid = "SSID"; // The SSID (name) of the Wi-Fi network you want to connect to
const char* password = "PASSWORD"; // The password of the Wi-Fi network
void setup() {
Serial.begin(115200); // Start the Serial communication to send messages to the computer
delay(10);
Serial.println('\n');
WiFi.begin(ssid, password); // Connect to the network
Serial.print("Connecting to ");
Serial.print(ssid); Serial.println(" ...");
int i = 0;
while (WiFi.status() != WL_CONNECTED) { // Wait for the Wi-Fi to connect
delay(1000);
Serial.print(++i); Serial.print(' ');
}
Serial.println('\n');
Serial.println("Connection established!");
Serial.print("IP address:\t");
Serial.println(WiFi.localIP()); // Send the IP address of the ESP8266 to the computer
}
void loop() { }
The code to connect to a wireless access point is relatively straightforward: enter the SSID and the password of the network you want to connect to, and call the WiFi.begin function. Then wait for the connection to complete, et voilĂ , your ESP8266 is now connected to your Local Area Network.