[SOLVED] Blynk cloud with SparkFun ESP8266 shield


this is the furthest I’ve got to getting blynk-cloud working with more than 1 connection using this wifi shield (not simultaneous connections, not needed in my case)

SparkFun ESP8266 AT library - Demo
Jim Lindblom @ SparkFun Electronics
Original Creation Date: July 16, 2015
This code is released under the MIT license.
Distributed as-is; no warranty is given.

// Library Includes //
// SoftwareSerial is required (even you don't intend on
// using it).
#include <SoftwareSerial.h> 
#include <SparkFunESP8266WiFi.h>

#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
SoftwareSerial EspSerial(8, 9); // RX, TX
#define ESP8266_BAUD 9600
ESP8266 wifi(&EspSerial);

// WiFi Network Definitions //
// Replace these two character strings with the name and
// password of your WiFi network.
const char mySSID[] = "ssid";
const char myPSK[] = "pass";
char auth[] = "auth";

  int pinValue = param.asInt(); 
  // process received value

void setup() 


  // initializeESP8266() verifies communication with the WiFi
  // shield, and sets it up.

  // connectESP8266() connects to the defined WiFi network.

  // displayConnectInfo prints the Shield's local IP
  // and the network it's connected to.

  ESP8266Client client;
  int retVal = client.connect("blynk-cloud.com", 80);
  if (retVal <= 0)
    Serial.println("Failed to connect to server.");
  if (retVal > 0)




  Blynk.begin(auth, wifi, mySSID, myPSK);

void loop() 



void initializeESP8266()
  // esp8266.begin() verifies that the ESP8266 is operational
  // and sets it up for the rest of the sketch.
  // It returns either true or false -- indicating whether
  // communication was successul or not.
  // true
  int test = esp8266.begin();
  if (test != true)
    Serial.println(F("Error talking to ESP8266."));
  Serial.println(F("ESP8266 Shield Present"));

void connectESP8266()
  // The ESP8266 can be set to one of three modes:
  //  1 - ESP8266_MODE_STA - Station only
  //  2 - ESP8266_MODE_AP - Access point only
  //  3 - ESP8266_MODE_STAAP - Station/AP combo
  // Use esp8266.getMode() to check which mode it's in:
  int retVal = esp8266.getMode();
  if (retVal != ESP8266_MODE_STA)
  { // If it's not in station mode.
    // Use esp8266.setMode([mode]) to set it to a specified
    // mode.
    retVal = esp8266.setMode(ESP8266_MODE_STA);
    if (retVal < 0)
      Serial.println(F("Error setting mode."));
  Serial.println(F("Mode set to station"));

  // esp8266.status() indicates the ESP8266's WiFi connect
  // status.
  // A return value of 1 indicates the device is already
  // connected. 0 indicates disconnected. (Negative values
  // equate to communication errors.)
  retVal = esp8266.status();
  if (retVal <= 0)
    Serial.print(F("Connecting to "));
    // esp8266.connect([ssid], [psk]) connects the ESP8266
    // to a network.
    // On success the connect function returns a value >0
    // On fail, the function will either return:
    //  -1: TIMEOUT - The library has a set 30s timeout
    //  -3: FAIL - Couldn't connect to network.
    retVal = esp8266.connect(mySSID, myPSK);
    if (retVal < 0)
      Serial.println(F("Error connecting"));

void displayConnectInfo()
  char connectedSSID[24];
  memset(connectedSSID, 0, 24);
  // esp8266.getAP() can be used to check which AP the
  // ESP8266 is connected to. It returns an error code.
  // The connected AP is returned by reference as a parameter.
  int retVal = esp8266.getAP(connectedSSID);
  if (retVal > 0)
    Serial.print(F("Connected to: "));

  // esp8266.localIP returns an IPAddress variable with the
  // ESP8266's current local IP address.
  IPAddress myIP = esp8266.localIP();
  Serial.print(F("My IP: ")); Serial.println(myIP);

// errorLoop prints an error code, then loops forever.
void errorLoop(int error)
  Serial.print(F("Error: ")); Serial.println(error);
  Serial.println(F("Looping forever."));
  for (;;)

// serialTrigger prints a message, then waits for something
// to come in from the serial port.
void serialTrigger(String message)
  while (!Serial.available())
  while (Serial.available())

On the first connection, the ESP connects to blynk-cloud.com, printed “connected.” great.
then I disconnect and try to use Blynk.begin(with parameters),
I see the blynk logo, its trying to connect, but im getting ESP not responding,
I have a hunch its related to the software RX/TX ports being in use?? I have no idea how to free them up if thats the case.

any idea how to finally get this working?

I managed to find a workaround by not using the sparkfun libraries at all,
and using the ones provided by Blynk, API docs here:
examples helped alot:

The topic can be closed.