Add details :
• Hardware model + communication type. For example: Arduino UNO with Ethernet Shield
• Smartphone OS (iOS or Android) + version
• Blynk server or local server
• Blynk Library version
• Add your sketch code. Code should be formatted as example below.
Simply paste your code between ``` If you don’t format your code, your topic can be deleted by moderators.
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken"; //Put Your Auth Token Here
//Array to store Network Credentials for different WiFi Networks
const char* KNOWN_SSID[] = {"Nucleus", "Factory Forward", "SSID3"}; //Put all Your WiFi Network Names
const char* KNOWN_PASSWORD[] = {"", "1234567809", "Pass3"}; //Put the WiFi Passwords in same order. For Open networks leave the password blank inside the double quotes.
const int KNOWN_SSID_COUNT = sizeof(KNOWN_SSID) / sizeof(KNOWN_SSID[0]); // number of known networks
void setup() {
boolean wifiFound = false;
int i, n;
Serial.begin(9600);
// ----------------------------------------------------------------
// Set WiFi to station mode and disconnect from an AP if it was previously connected
// ----------------------------------------------------------------
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);
Serial.println("Setup done");
// ----------------------------------------------------------------
// WiFi.scanNetworks will return the number of networks found
// ----------------------------------------------------------------
Serial.println(F("Scan start"));
int nbVisibleNetworks = WiFi.scanNetworks();
Serial.println(F("Scan Completed"));
if (nbVisibleNetworks == 0) {
Serial.println(F("No networks found. Reset to try again"));
while (true); // no need to go further, hang in there, will auto launch the Soft WDT reset
}
// ----------------------------------------------------------------
// if you arrive here at least some networks are visible
// ----------------------------------------------------------------
Serial.print(nbVisibleNetworks);
Serial.println(" network(s) found");
// ----------------------------------------------------------------
// check if we recognize one by comparing the visible networks
// one by one with our list of known networks
// ----------------------------------------------------------------
for (i = 0; i < nbVisibleNetworks; ++i) {
Serial.println(WiFi.SSID(i)); // Print current SSID
for (n = 0; n < KNOWN_SSID_COUNT; n++) { // walk through the list of known SSID and check for a match
if (strcmp(KNOWN_SSID[n], WiFi.SSID(i).c_str())) {
Serial.print(F("\tNot matching "));
Serial.println(KNOWN_SSID[n]);
} else { // we got a match
wifiFound = true;
break; // n is the network index we found
}
} // end for each known wifi SSID
if (wifiFound) break; // break from the "for each visible network" loop
}
if (!wifiFound) {
Serial.println(F("No Known Network identified. Reset to try again"));
while (true);
}
const char* ssid = (KNOWN_SSID[n]);
const char* pass = (KNOWN_PASSWORD[n]);
Serial.println(WiFi.localIP());
Blynk.begin(auth, ssid, pass);
Serial.println("Blynk Connected"); //Connected and Authenticated with Blynk Server
}
void loop()
{
Blynk.run();
}
Please do not create multiple topics for same issue… I merged your 2nd topic Titled (Hi dears blynker can you all help me to add 2 ssid and 2 passwords i mean mukti ssid & passwords) here.
Please also format all posted code properly as required in the Welcome Topic or your posts will be deleted.
Another option:
If you have a spare Arduino board that’s compatible with the Keyboard library, and a spare pushbutton, wire the pushbutton between the defined pin and ground, and load the following sketch. With the board plugged into a USB port on your PC, you can push the button to generate the required characters.
#include <Keyboard.h>
#define BUTTON 2 // pin for button
void setup() {
pinMode(BUTTON, INPUT_PULLUP);
Keyboard.begin();
}
void loop() {
if (digitalRead(BUTTON) == LOW) {
Keyboard.print("```cpp\n```\n");
delay(200); // delay for button debounce
while (digitalRead(BUTTON) == LOW) {} // wait for button release
}
}
The “elegant” solution to “source code formatting” would be this
I’ve only spent a couple of hours working on this little plugin, but it would save a lot of posts for moderators.
This forum already has those characters sitting there ready for the initial post… just create a new topic and chose the category… bingo… Copy/Paste for further posting.
I had never seen this feature for new topics
New users have no excuse to format the code
Maybe this new button for those who reply would also be comfortable