LED Control - Arduino + Blynk

Hello! I am pretty familiar with Arduio and done some projects with it. I just got an Ethernet Shield and wanting to start off with Blynk, as I find it really nice. I beginned with the Blink Blueprint and got my Arduino Uno online, but it changing the state of the button/tapping it, from the app or from the web, wont on/off the LED! I used different pins, tried other values for the V0 datastream etc. but no success. This is the initial code from the Blueprint.


// *** MAIN SETTINGS ***
// Replace this block with correct template settings.
// You can find it for every template here:
//
//   https://blynk.cloud/dashboard/templates

#define BLYNK_TEMPLATE_ID "TMPL4PTUvo6ob"
#define BLYNK_TEMPLATE_NAME "Hello LED 1"
#define BLYNK_AUTH_TOKEN "***"

#define BLYNK_PRINT Serial

// Adding the required libraries
#include <SPI.h>
#include <Ethernet.h> // You need to add it by searching "Ethernet" in libraries and install it
#include <BlynkSimpleEthernet.h> // You need to add it by searching "Blynk" in libraries and install it

#define LED_PIN 13

void setup()
{
  pinMode(LED_PIN, OUTPUT);
  // Debug console
  Serial.begin(115200);

  Blynk.begin(BLYNK_AUTH_TOKEN);
}

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

BLYNK_WRITE(V0)
{
  int value = param.asInt();

  if (value == 1)
  {
    digitalWrite(LED_PIN, HIGH);
  }
  else
  {
    digitalWrite(LED_PIN, LOW);
  }
}

Nothing jumps out at me as being wrong, especially if your device is connecting to Blynk successfully and showing as being online.

How is your V0 virtual datastream set up? It should be an integer data type and have a min value of 0 and max value of 1.

The switch widget that you have attached to V0 shouldn’t have any override values set up, and it should be configured to operate in Switch mode.

If all of these are correct, are you able to use a sketch to turn the LED on pin 13 on and off - to prove that the LED is functioning as expected with your Ethernet shield in place.

Pete.

Hi! Thanks for the reply and all your useful informations you posted around here. I happened to find out after opening an Example Sketch from the Blynk library that the pins 10, 11, 12, 13 are used by the ethernet shield, so it is impossible to use them. Hope this will help others too!

1 Like