I was trying to change D0 pin value with HTTP restful api but it is not not changing it is with my nodemcu board
What’s the syntax your using?
For virtual pin this works.
The syntax I am using is http://blynk-cloud.com/auth_token/update/D0?value=1
Are you simply pasting this into your browser, or using it with a 3rd party service such as IFTTT?
Is this local or cloud server?
I think it depends which board type you chose in your app project, but you’ll probably find that D0 in the API call is referring to GPIO0, which is the pin labelled D3 on the NodeMCU.
I want to control the built in led of nodemcu board by using HTTP restful api and I am making a app in mit app inventor and calling the api
Okay, the built-in blue LED near the WiFi antenna on the NodeMCU is connected to the pin that is labelled D4 on the board. Ignore these numbers printed on the board, they will confuse you. Instead use the GPIO numbers…
So you’ll see that the pin labelled D4 on the board is actually GPIO2, which is referenced in the Blynk API as Digital Pin 2, or D2
The other important thing about this LED is that it’s Active LOW, which means that you have to send a “0” to turn it on, and a “1” to turn it off.
As you didn’t answer my question about local or cloud server, I’ll assume that you’re using one of the Blynk cloud servers.
There are three of these dotted around the world, but your project (and auth code) only exists on one of them. This will normally be the one that is geographically closest to you.
In normal circumstances it doesn’t matter which server your project is on, the app and your NodeMCU take care of connecting to the correct one, but the API can’t do this. So, if the API call is being made from a server that is somewhere else in the world then it might resolve
blynk-cloud.com to a different geographical server and it won’t find your project and return an “Invalid Auth code” message
As a result, you really need to specify the IP address of the server where your project is, rather than using
To obtain the IP address of this server, open a terminal screen and type
ping blynk-cloud.com. The result should show the IP address of the server where your project lives.
As you’re in Nepal, I guess your project may live on the Singapore sever, whose IP address is 220.127.116.11 but that assumes that your ISP isn’t doing anything odd with its DNS settings.
This means that your API call will look more like this:
(obviously you’ll replace “auth_token” with your own unique auth code for your device).
Some NodeMCU’s also have an additional LED near the USB connector, which is connected to GPIO16.
If you’re wanting to control this then the API call would be
I’m not sure if this LED is active HIGH or LOW, but it’s very easy to try both options to see what happens.
Thanks it worked it really helped me
Is it also same for Esp32
There are lots of different ESP32 Dev Boards about, so it depends on where the board manufacturer has placed LEDs.
If you have an ESP32 DevKit V1 board like this:
the the onboard LED is also connected to GPIO2
So we have to write According to GPIO format correct like D0
You have to use the GPIO mummer with a “D” at the beginning in your API call:
GPIO0 = D0
GPIO1 = D1
GPIO2 = D2