Simple NodeMCU blink, with Graph, not blinking

I want by NodeMCU to blink according to a button on Blynk and a graph to track it using virtual pins, the tracking works but problem is D0 is not blinking
I will try with other pins later but this should be very simple, guess not…

any help is appreciated!

#define BLYNK_PRINT Serial


#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>


char auth[] = "the_auth";

BlynkTimer timer;

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

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

  Blynk.begin(auth, ssid, pass);
  // You can also specify server:

  pinMode(0,OUTPUT);
}

BLYNK_WRITE(V1)
{
  //Get V1 value
  int buttonState = param.asInt();

  //Send to D0 that is connected to V1
  digitalWrite(0,buttonState);

  //Send to Graph that is connected to V6
  Blynk.virtualWrite(V6, buttonState);

  //make it string and print
  String numberString = String(buttonState);
    Serial.println("BLYNK_WRITE btn is: "+numberString);
}

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

The label of D0 on your ModeMCU is not GPIO 0, it is GPIO 16.

Study the pinout for your hardware and pin 16 is best avoided if ever you want to use deepSleep.

1 Like

Thank you for the quick reply, and it WORKS!
as you can tell I’m new to this (hardware), will need to learn more
didn’t know what deepSleep was, thanks!

BTW I was trying to edit the project from this video, that’s why I was using GPIO 0

Yes the video is for an Arduino where D0 is GPIO 0, not an ESP where the manufacturers thought having labels different to the internal GPIO references was a good idea.

:rofl: makes it more fun!

I have another questions, should I make a new topic or ask here?

New topic.