Stuck with blynk code for Arduino nano+esp01 wifi module

Before creating the topic

  1. Search forum for similar topics
  2. Check http://docs.blynk.cc and http://help.blynk.cc/
  3. 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. :point_up: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.

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

/* Fill-in your Template ID (only if using Blynk.Cloud) */
//#define BLYNK_TEMPLATE_ID   "YourTemplateID"


#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";

// Hardware Serial on Mega, Leonardo, Micro...
#define EspSerial Serial1

// or Software Serial on Uno, Nano...
//#include <SoftwareSerial.h>
//SoftwareSerial EspSerial(2, 3); // RX, TX

// Your ESP8266 baud rate:
#define ESP8266_BAUD 115200

ESP8266 wifi(&EspSerial);

void setup()
{
  // Debug console
  Serial.begin(9600);

  delay(10);

  // Set ESP8266 baud rate
  EspSerial.begin(ESP8266_BAUD);
  delay(10);

  Blynk.begin(auth, wifi, ssid, pass);
}

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

//Error i received while uploading to Nano :/
#error This code is intended to run on the Mega2560 platform! Please check your Tools->Board setting.
    ^~~~~
Multiple libraries were found for "BlynkSimpleShieldEsp8266.h"
 Used: 
exit status 1
Error compiling for board Arduino Nano.

You should comment this line out, and include this instead

Like this

// Hardware Serial on Mega, Leonardo, Micro...
//#define EspSerial Serial1

// or Software Serial on Uno, Nano...
#include <SoftwareSerial.h>
SoftwareSerial EspSerial(2, 3); // RX, TX

Tried that, it still says the same thing
see it shows the same error :confused:

’ ’ ’
In file included from C:\Users\tejas\AppData\Local\Temp\arduino_modified_sketch_772872\ESP8266_Shield.ino:40:
C:\Users\tejas\Documents\Arduino\libraries\Blynk_Esp8266AT_WM\src/BlynkSimpleShieldEsp8266.h:45:4: error: #error This code is intended to run on the Mega2560 platform! Please check your Tools->Board setting.
45 | #error This code is intended to run on the Mega2560 platform! Please check your Tools->Board setting.
| ^~~~~
Multiple libraries were found for “BlynkSimpleShieldEsp8266.h”
Used: C:\Users\tejas\Documents\Arduino\libraries\Blynk_Esp8266AT_WM
Not used: C:\Users\tejas\Documents\Arduino\libraries\Blynk
exit status 1
Error compiling for board Generic ESP8266 Module.
’ ’ ’

Is something wrong here, please help!

???

i tried uploading to the wifi module accidentally, but still the nano does’nt work

Do you have any solution for nano?

That’s a problem, as you will have over-written the factory AT firmware on the ESP-01, so it will no longer be able to act as a WiFi modem for your Nano.
You will need to restore the AT firmware to the ESP-01.

You are also getting this compiler warning:

I’d recommend that you un-install the 3rd party library that neds in _WM and stick with the official Blynk library, and ensure that you’re using version 0.6.1 if you’re using Blynk Legacy, or 1.0.1 if you’re using Blynk IoT.

This error message:

is because you have this line of code in your sketch:

and you ignored this information:

The Arduino Uno and Nano only have one serial port (Serial0) so it’s impossible to connect the ESP-01 module to port Serial1, as it doesn’t exist.

TBH, you’d be better-off throwing the Nano and ESP-01 in the bin, and using either a NodeMCU, Wemos D1 Mini or ESP-32, as these have WiFi built-in, and are also much faster and more powerful than the Nano (and are easier to work with).

If you do want to persist with restoring the AT firmware on the ESP-01 and using it with the Nano then you need to read this (and I’d recommend that you read it ALL)…

Pete.

I did uncomment the softwareserial line and did try everything, but yea you’re right it’s a pain just to add additional modules to get a connection going, I ditched it thanks

1 Like