Switch data Send and receive nodmcu esp8266

dear can i combine these code will it work at same time send and receive what will be the code

thanks i have gone through this but these code work only one at a time

for switch i have to ground pins

Of course… they are just examples. Once you get past the basic Blynk examples you need to do lots of reading and experimenting in-order to learn how the commands work and how add them together to make your projects work.

Blynk - RE-SEAR-CH

We can try to assist with suggestions and some guidance… but we can’t teach you or do it for you. We are just fellow Blynk users and volunteers, and we have our own projects and lives.

Umm, sure… depends on what and how you want to physically hook them up. Google for the various ways to wire in a button or switch (technically same thing at far as the GPIO is concerned) with either pull-down or pull-up resistors, depending on your need to drive a GPIO HIGH or LOW on button press.

For example…

i want to use digital pins as input

and digital pin as output

You are in good hands then with an ESP8266… they have GPIO (General Purpose INPUT & OUTPUT) pins

And Blynk has documentation showing how to use them…

etc…

thanks gunner for sharing this i just want to do same thing pressing switch physicaly but led should light up on blynk app. iam not geting to work out on blynk physically its doing good as shown

i have manage to made a working code just want little help i want to add one more widget to get data from pin D5 and display it on virtual pin v4 in this code its not working please help

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


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

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

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

// Select your pin with physical button
const int btnPin = 4;

WidgetLED led3(V3);

BlynkTimer timer;

// V3 LED Widget represents the physical button state
boolean btnState = false;
void buttonLedWidget()
{
  // Read button
  boolean isPressed = (digitalRead(btnPin) == LOW);

  // If state has changed...
  if (isPressed != btnState) {
    if (isPressed) {
      led3.on();
    } else {
      led3.off();
    }
    btnState = isPressed;
  }
}

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

  Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);

  // Setup physical button pin (active low)
  pinMode(btnPin, INPUT_PULLUP);
  pinMode(D1,OUTPUT);
  pinMode(D7,OUTPUT);
  pinMode(D3,OUTPUT);
  pinMode(D4,OUTPUT);

  digitalWrite(D1,HIGH);
  digitalWrite(D7,HIGH);
  digitalWrite(D3,HIGH);
  digitalWrite(D4,HIGH);
  
  timer.setInterval(500L, buttonLedWidget);
}

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

I fixed your post… you need to properly format any posted code as per the directions…

Probably becasue you are not actually doing anything to send data to any widget on V4… Please read!!

http://help.blynk.cc/getting-started-library-auth-token-code-examples/blynk-basics/what-is-virtual-pins

http://help.blynk.cc/getting-started-library-auth-token-code-examples/blynk-basics/how-to-display-any-sensor-data-in-blynk-app

i have used one widget and geting switch data from d2 pin on nodmcu and lighting up led connected with virtual pin v3 as per code in blynk app i want to add another switch on pin d5 on nodmcu and led on virtual pin v4 in blynk in the same code not doin right please help with my code i you can .

It appears that you are not even trying…

Sorry, I am not writing your code for you. There is plenty of perfectly good documentation and examples for such simple processes… if you will not read, I will not bother pointing them out any further.

dear gunner i have already made the code just want addition

Dear @Peacefinder… I deleted your repetitively posted but still unformatted code.

If you can’t even follow those simple directions, let-alone do some reading and learning of your own, despite being handed all the instructions, then this topic will soon be closed.

ok thanks for your help will do it my self iam disabled student want to learn and new to this community your kind response is my motivation to do thing that no one will give you support for .

I beg to differ. @Gunner has given you some pretty good support, IMO. The link he posted titled “How to display ANY sensor data in Blynk app” contains all the information you would need to get data from D5 and display it on v4.

If you provide some more details, such as what data is being collected on D4 (temperature, acceleration, switch, etc.) as well as what is providing that type of data (i.e sensor type), we may be able to point you to a more specific example in the Sketch builder.

You can also try searching this forum by the sensor type you are using (dht11, ds18b20, adxl337, etc.) and see if there are some examples out there for you to use.

Just know you need at least a basic understanding of programming to be able to successfully do cut and past programming.

I also have learning disabilities, including dyslexic tendency’s, that really make learning from written words… interesting… but I still manage, so can you.

thanks gunner for all your responce all are help full in this regard i will learn and sort out my need

thanks for your kind responce toro_blanco ihave connected switch on d5 and d1 of nod mcu and connected v3, v4 virtual pin with led on blynk app iam geting responce for v3 but not v4 circuit and net connectivity is perfect somthing with code

Post a copy of your latest code. Properly formatted that is.