NodeMCUWiFi old code

This commit is contained in:
unrealdragon 2026-07-30 15:13:00 +05:30
commit 21b6c3f760

View file

@ -2,8 +2,8 @@
#include <WiFiUdp.h>
#include <spi_flash.h>
#define WIFI_SSID ""
#define WIFI_PASS ""
#define WIFI_SSID "KAIPPUZHAKKUNNEL"
#define WIFI_PASS "7042754150"
#define IP_BROADCAST "192.168.1.255"
#define UDP_PORT 8176
@ -21,7 +21,6 @@ void setup() {
WiFi.begin(WIFI_SSID, WIFI_PASS);
pinMode(echoPin, INPUT);
pinMode(triggerPin, OUTPUT);
status = "Connecting";
while(WiFi.status() != WL_CONNECTED) {
delay(500);
@ -29,6 +28,7 @@ void setup() {
status = WiFi.localIP().toString();
Serial.begin(9600);
Serial.println("Got IP: " + status);
Serial.println("Sending messages to: " + String(IP_BROADCAST));
int err = client.begin(81);
if(err == 0) {
Serial.println("Failed to create UDP Socket");
@ -41,7 +41,6 @@ void setup() {
}
void loop() {
digitalWrite(triggerPin, LOW);
delayMicroseconds(20);
digitalWrite(triggerPin, HIGH);
@ -74,6 +73,6 @@ void loop() {
client.beginPacket(IP_BROADCAST, UDP_PORT);
client.write(buff, sizeof(float));
client.endPacket();
delay(3000);
delete[] buff;
delay(3000);
}