App will not connect to esp32-wroom-32 board

A lightning storm caused damage to an old ESP 32 board, and I had a replacement that was purchased at the same time. Despite uploading the same code, I couldn’t establish a connection between the app and the new board. While the 32-board connects successfully to the web server website on Blynk.Console and all functions and I/Os operate normally, it fails to be recognized by the iPhone app after the code upload. I attempted to reset the board to its factory .bin settings, and initially, the WiFi appeared on my phone. However, after uploading the code, the WiFi network no longer shows up on my phone.
I did try using the quick start test file, and I managed to establish a connection between the board and the app. This indicates that there might be an issue in the code or that I might be overlooking something important.

Any help is greatly appreciated

If I did the code wrong, just let me know

#define BLYNK_TEMPLATE_ID "Gate and Garage "
#define BLYNK_AUTH_TOKEN "8888888888I"

#include <Blynk.h>

#include <WiFi.h>
#include <BlynkSimpleEsp32.h>

// Replace with your Blynk auth token
char auth[] = "8888888888888888888888";

// Replace with your WiFi credentials
char ssid[] = "8888888888";
char pass[] = "8888888888";

// Pin definitions for output control
int output1 = 21;
int output2 = 22;

// Pin definitions for input control
int input1 = 32;
int input2 = 33;
int input3 = 34;
int input4 = 35;

BlynkTimer timer;

void myTimerEvent()
{
  // Read the state of the input pins
  int input1State = digitalRead(input1);
  int input2State = digitalRead(input2);
  int input3State = digitalRead(input3);
  int input4State = digitalRead(input4);

  // Send the input states to the Blynk app
  Blynk.virtualWrite(V3, input1State);
  Blynk.virtualWrite(V4, input2State);
  Blynk.virtualWrite(V5, input3State);
  Blynk.virtualWrite(V6, input4State);
}

BLYNK_WRITE(V1) {
  int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable
  digitalWrite(output1, pinValue);
}

BLYNK_WRITE(V2) {
  int pinValue = param.asInt();
  digitalWrite(output2, pinValue);
}

void setup() {
  pinMode(output1, OUTPUT);
  pinMode(output2, OUTPUT);
  pinMode(input1, INPUT);
  pinMode(input2, INPUT);
  pinMode(input3, INPUT);
  pinMode(input4, INPUT);
  Blynk.begin(auth, ssid, pass);
  timer.setInterval(1000, myTimerEvent);
}

void loop() {
  Blynk.run();
  timer.run();
}

```cpp

void loop()

The code didn’t copy correctly so we will try again

#define BLYNK_TEMPLATE_ID "xxxxx"
#define BLYNK_TEMPLATE_ID "Gate and Garage "
#define BLYNK_AUTH_TOKEN "xxxxxxx"

#include <Blynk.h>

#include <WiFi.h>
#include <BlynkSimpleEsp32.h>

// Replace with your Blynk auth token
char auth[] = "xxxxxxxxxx";

// Replace with your WiFi credentials
char ssid[] = "xxxxxxxxxx";
char pass[] = "xxxxxxxxx";

// Pin definitions for output control
int output1 = 21;
int output2 = 22;

// Pin definitions for input control
int input1 = 32;
int input2 = 33;
int input3 = 34;
int input4 = 35;

BlynkTimer timer;

void myTimerEvent()
{
  // Read the state of the input pins
  int input1State = digitalRead(input1);
  int input2State = digitalRead(input2);
  int input3State = digitalRead(input3);
  int input4State = digitalRead(input4);

  // Send the input states to the Blynk app
  Blynk.virtualWrite(V3, input1State);
  Blynk.virtualWrite(V4, input2State);
  Blynk.virtualWrite(V5, input3State);

The WiFi network generated by the board isn’t supposed to show-up on your phone, and the device doesn’t connect directly to your phone.
The device connects to the Blynk serer, and both the web console and the app also connect to the Blynk server.

If the device is connecting to the Blynk server and is showing as being “Online” in the web console then your code is working correctly. If the device either isn’t showing in the Blynk app, or it is showing but is listed as “Offline”, then its an issue with the app.

Before giving advice about how to proceed it would be useful if you’d clarify exactly what behaviour you are seeing, and provide information about the phone OS, Blynk app version, and some screenshots of what exactly you’re seeing in the devices screen and the device dashboard in the app.

Pete.

basically, when you try to “Add Device” on the app it will spin like it is connecting and then the app says “Something went wrong” The board never shows connected.
I have tried to connect manually but it says the same thing “Something went wrong”
The board does connect and is online with the web server.
Video of the web server working
Blynk app ver 3.5.7 (0)
iOS ver 16.6

Is there a way to get a QR code with the free version? That is the only thing I haven’t tried.
Thanks

You’ve said that your device already shows on the web console, so it’s already been added (created from the template, provisioned with an Auth token and WiFi credentials). There is no new device to add, which is why it fails.

Once the device is added to your account it should be visible in both the web console and the app.
Are you logged-in to the app with the same account that you’re logged in to the web console?

Pete.

Very good question,
I did change the name inside the “Organization Settings” on the web server and the name did change on the phone app. I also check my wife’s phone app and it also only gives the option to “add Device”

Thanks for the help,
Trell

I’d suggest you delete the device in the web console, press whatever button you’ve declared as the reset button in Settings.h for 10 seconds then go to the app and do “+ Add Device” again.
Look at your device’s serial monitor while you do this and see what happens.
If it doesn’t work the report back with an update.

Pete.

Alright, I’ve made progress and managed to resolve the issue. It turns out that the problem was related to using the old AUTH token from the previous board. I’ve learned that you can’t do that. Even if you’re using the same type of board, when switching to a new one, you need to delete the previous board from Blynk.Console. After that, with the new board, I added a new Device in Blynk.Console and obtained a fresh Auth Token. Then, I programmed the new board using this new Auth Token, and voilà! The app came online as soon as the board connected to Wi-Fi.

Mr. Pete, If we ever meet, I owe you a beer. Thanks for staying with me and giving me ideas on what to do