Which library to use to arduino and esp8266 please help

when i tried
esp82866_hardware
also tried software
wen i compile its showing me error not compiling

Are you using the latest stable release 0.3.1 or the latest beta 0.3.3.

With the beta I’m not convinced the libraries are correctly structured.

Use 0.3.1. and you should get 4 libraries (Blynk, SimpleTimer and 2 relating to hard and soft serial).

Please indicate what the compile error is.

hey costas thanks for your valuable feedback
finally after downloading latest library code is compiling but which library i should use ??
esp8266-software
or
esp8266 hardware
please help me

Which Arduino are you using as some only have one serial port but hardware serial is generally better?

I am a Windows guy but I installed 1.6.7 on an Ubuntu machine last night and also had fun with the libraries. My sketch contains some of the latest Blynk features (plus OTA firmware updates etc) like virtualSync so after I had used 0.3.1 I had to extract the 0.3.3 beta and overwrite the Blynk libraries.

hi costas i am done with my wiring stuff which code should i use my laptop is on i have wired my esp8266 wih arduino mega

please help me or guide me

/**************************************************************

  • Blynk is a platform with iOS and Android apps to control
  • Arduino, Raspberry Pi and the likes over the Internet.
  • You can easily build graphic interfaces for all your
  • projects by simply dragging and dropping widgets.
  • Downloads, docs, tutorials: http://www.blynk.cc
  • Blynk community: http://community.blynk.cc
  • Social networks: http://www.fb.com/blynkapp
  •                           http://twitter.com/blynk_app
    
  • Blynk library is licensed under MIT license
  • This example code is in public domain.

  • This example shows how to use ESP8266 Shield via Hardware Serial
  • (on Mega, Leonardo, Micro…) to connect your project to Blynk.
  • Note: Ensure a stable serial connection to ESP8266!
  •   Firmware version 1.0.0 (AT v0.22) or later is needed.
    
  •   You can change ESP baud rate. Connect to AT console and call:
    
  •       AT+UART_DEF=115200,8,1,0,0
    
  • Change WiFi ssid, pass, and Blynk auth token to run :slight_smile:
  • Feel free to apply it to any other example. It’s simple!

**************************************************************/
//#define BLYNK_DEBUG
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <ESP8266_HardSer.h>
#include <BlynkSimpleShieldEsp8266_HardSer.h>

// Set ESP8266 Serial object
#define EspSerial Serial1

ESP8266 wifi(EspSerial);

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

void setup()
{
// Set console baud rate
Serial.begin(9600);
delay(10);
// Set ESP8266 baud rate
EspSerial.begin(115200);
delay(10);

Blynk.begin(auth, wifi, “scientist”, “9820494181”);
}

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

i am getting an error

ESP8266_Shield_HardSer.ino:31:29: fatal error: ESP8266_HardSer.h: No such file or directory
compilation terminated.
Multiple libraries were found for “BlynkSimpleShieldEsp8266_HardSer.h”
Used: C:\Users\soumil\Documents\Arduino\libraries\blynk-library-master
Not used: C:\Program Files (x86)\arduino-1.6.4\libraries\blynk-library-0.3.1
Not used: C:\Users\soumil\Documents\Arduino\libraries\blynk-library-0.3.1
Error compiling.
Exception in thread “AWT-EventQueue-0” java.lang.NullPointerException
at javax.swing.text.ParagraphView.getClosestPositionTo(ParagraphView.java:274)
at javax.swing.text.ParagraphView.getNextNorthSouthVisualPositionFrom(ParagraphView.java:241)
at javax.swing.text.CompositeView.getNextVisualPositionFrom(CompositeView.java:476)
at javax.swing.text.Utilities.getNextVisualPositionFrom(Utilities.java:1045)
at javax.swing.text.CompositeView.getNextNorthSouthVisualPositionFrom(CompositeView.java:726)
at javax.swing.text.CompositeView.getNextVisualPositionFrom(CompositeView.java:476)
at javax.swing.plaf.basic.BasicTextUI$RootView.getNextVisualPositionFrom(BasicTextUI.java:1588)
at javax.swing.plaf.basic.BasicTextUI.getNextVisualPositionFrom(BasicTextUI.java:1127)
at javax.swing.text.DefaultEditorKit$NextVisualPositionAction.actionPerformed(DefaultEditorKit.java:1690)
at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1663)
at javax.swing.JComponent.processKeyBinding(JComponent.java:2882)
at javax.swing.JComponent.processKeyBindings(JComponent.java:2929)
at javax.swing.JComponent.processKeyEvent(JComponent.java:2845)
at java.awt.Component.processEvent(Component.java:6302)
at java.awt.Container.processEvent(Container.java:2234)
at java.awt.Component.dispatchEventImpl(Component.java:4881)
at java.awt.Container.dispatchEventImpl(Container.java:2292)
at java.awt.Component.dispatchEvent(Component.java:4703)
at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1954)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:806)
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1074)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:945)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:771)
at java.awt.Component.dispatchEventImpl(Component.java:4752)
at java.awt.Container.dispatchEventImpl(Container.java:2292)
at java.awt.Window.dispatchEventImpl(Window.java:2750)
at java.awt.Component.dispatchEvent(Component.java:4703)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

To which Serial port have you linked your ESP? Your sketch says something about software serial, but as @Costas indicated, you need to use hardware serial with a Mega. You can’t do 115200 over SoftwareSerial, it’s too fast.

How is your ESP wired up?

@scientist1995 when you compile the sketches you have to have the correct board settings. With the sketch below (Mega with ESP shield) it will not compile if I have my regular board settings of Wemos D1 Mini. If I change the board to Mega it compiles fine with 1.6.7 and 0.3.3 (assuming you have the libraries installed correctly).

 * You can easily build graphic interfaces for all your
 * projects by simply dragging and dropping widgets.
 *
 *   Downloads, docs, tutorials: http://www.blynk.cc
 *   Blynk community:            http://community.blynk.cc
 *   Social networks:            http://www.fb.com/blynkapp
 *                               http://twitter.com/blynk_app
 *
 * Blynk library is licensed under MIT license
 * This example code is in public domain.
 *
 **************************************************************
 *
 * This example shows how to use ESP8266 Shield via Hardware Serial
 * (on Mega, Leonardo, Micro...) to connect your project to Blynk.
 *
 * Note: Ensure a stable serial connection to ESP8266!
 *       Firmware version 1.0.0 (AT v0.22) or later is needed.
 *       You can change ESP baud rate. Connect to AT console and call:
 *           AT+UART_DEF=115200,8,1,0,0
 *
 * Change WiFi ssid, pass, and Blynk auth token to run :)
 * Feel free to apply it to any other example. It's simple!
 *
 **************************************************************/
//#define BLYNK_DEBUG
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266_HardSer.h>
#include <BlynkSimpleShieldEsp8266_HardSer.h>

// Set ESP8266 Serial object
#define EspSerial Serial1

ESP8266 wifi(EspSerial);

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

void setup()
{
  // Set console baud rate
  Serial.begin(9600);
  delay(10);
  // Set ESP8266 baud rate
  EspSerial.begin(115200);
  delay(10);

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

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