简体   繁体   中英

How can i send data from ESP32 to C# VIsual Studio with WIFI

Here i have a code for connecting to my wifi

#include <WiFi.h>

const char* WIFI_NAME = "SARAN";
const char* WIFI_PASS = "00000000";

void setup() {
  Serial.begin(115200);
  delay(10);
              
              // Connect to WiFi network
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(WIFI_NAME);

  WiFi.begin(WIFI_NAME,WIFI_PASS);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");

// Print the IP address
  Serial.println(WiFi.localIP());

}

void loop() {
}

And i try to create window form app C# in Visual Studio to receive a DATA from ESP32. Please Help. Thank you.

Connecting to WIFI is always a kind of a pain because the communication requires local Wi-Fi network, SSID & password - all can change. I would like to suggest another direction: have another ESP device (can be WEMOS, ESP8266 or ESP32) connected with USB to the computer you use for C# code developing. The ESP32 will communicate with this device with ESPnow, which doesn't require local Wi-Fi network. The "cost" of this approach is of course another ESP device, the benefit is much bigger: you can move it from one computer to another, between rooms, houses or even at open doors.

I use it for exactly same target as you need - connect ESP32 to a windows 10 computer, developing with C#.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM