Nodemcu : How to Add simultaneously Button from Digital Pin and How to GET URL?

  1. How to control the relay connected to nodemcu pins D1 to D4 on simultaneously and how to get GET URL? …
    I want to send value 1 to D1-D4 and
    I want to send value 0 to D1-D4

  2. And after that i will send a get url with method webhooks … how do i know get url to control all digital pins simultaneously?


  2. Probably best to make up a function in your code that, when called, does all the stuff you want it to.

hi i get problem with my nodemcu…when led i put on D1 pin and send via webhooks with this format

http://ip/token/update/D5?value =1 this led is on
but http://ip/token/update/D1?value =1 is not working.

so D1 pin only received from GET D5, example http://ip/token/update/D5?value =1

…this is bug?

@erickfloors depends how you have set up the app as the API only interfaces the app with the MCU.

Provide all widget details for D1 and D5.

Also the D references are GPIO numbers not the MCU pin labels. So D1 and D5 on the NODEMCU are really 5 and 14 respectively. That is your error. In the API D stands for digital whereas V is for virtual, it doesn’t relate to the silly labels the NODEMCU and WeMos have on their boards.

can you tell me about this?

@erickfloors that is where the power of the virtual pins comes in.

In a virtual pin routine you can control as many digital pins as you like and then in the API / Webhook you just send the correct signal to the virtual pin.

  int control4DigitalPins = param.asInt();
  if(cotrol4DigitalPins == 1){
    digitalWrite(D1, HIGH);
    digitalWrite(D2, HIGH);
    digitalWrite(D3, HIGH);
    digitalWrite(D4, HIGH);
    digitalWrite(D1, LOW);
    digitalWrite(D2, LOW);
    digitalWrite(D3, LOW);
    digitalWrite(D4, LOW);

In this context the D references are the silly labels on the NODEMCU. I never use these and always use the GPIO references as it makes your code more portable between different devices.

got it…sorry for my mistaken…
i can see gpio number on ncu diagram…thank you

@Gunner another 2 posts for you to move :slight_smile:

Yup :wink:

@erickfloors I moved this discussion back into your already existing topic about your NodeMCU and API. Please keep all related discussion here, so as not to get spread all around the forum. Thanks.

But why setting in blynk application can work on pin D1 but not work in GET URL…it feels a bit strange

The API is sensibly set up for GPIO numbers and they are all that matter. Maybe ask NodeMCU and WeMos to remove their silly references on your board.