BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

I have tried by changing values of pins by passing strings but it not worked plz help me


#1

Gunner I have tried by changing values of pins by passing strings but it not worked plz help me
only this task left for me of writing value of pins
http://192.168.1.9:8080/80d3631030d247f0b4250eecc2410849/update/D4?value=“0”
http://192.168.1.9:8080/80d3631030d247f0b4250eecc2410849/update/D4?value="[“0”]"
i have passed in many ways
and my arduino sketch is this:

should i make any modifications regarding to write pin values plz gunner if i write and update values of pin my task will complete


HTTP Restful API Write digital pin value to 1 does not working
Invalid token with HTTP RESTful API (on Local Server ;P )
#2

@shama Please do not create 2nd accounts and use it to post the same issue on multiple topics… I have removed all of them and the unnecessary 2nd account.

As for your new issue, I moved tit into a new topic.

First you have not formatted your code as required… Please repost your code properly.

Blynk - FTFC

Secondly, if you would search and read other API related topics and look at the examples on the API document page you might see that you are using quotes around your values that are not needed.


#4

Please read the directions before posting any more unformatted code!


#5

So we should not use D2,D3 pins? what are PWM pins mean? actually i used 4 pins D3,D5,D6,D7 in blynk app and connected to nodemcu but when i try to execute same pins in browser it is not working


#6

Gunner i ddidn’t get u as u mentioned above to repost your code properly so i copy paste my code .what mistake i done?


#7

@shama I have moved your post above from another 2 year old topic… assid from being an old topic, it was irrelevant to your issue, which is basically not reading other posts about how to use proper API syntax :wink:

Do not use Dx silkscreened labeling for pins, use the proper GPIO designation for a pin.


#8

Read the links above… use the proper triple backticks before and after your code when pasting it in this forum.


#9

Plz post one example i cant getting u ,i mean GPIO pins how to parse string in url?


#10
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

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

IPAddress ip(192,168,1,39);
IPAddress gateway(192,168,1,1);
IPAddress subnet(255,255,255,0);

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "S.R.Electronics Lab";
char pass[] = "abcdef0123456";

void setup()
{
WiFi.config(ip,gateway,subnet);
WiFi.begin(ssid,pass);
Serial.begin(9600);
  
  Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,9),8080);
}

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

#11

This will turn on a physical LED to full intensity on digital PWM pin #9 on my Arduino… using Local Server.

http://10.10.3.13:8080/d1e516ca1d8b4d57a172dac786907a90/update/6?value=255

Google for pinouts of whatever board you are using… look for the standard GPIO/Arduino pin designations

For example on a Wemos D1 Mini


#12

http://10.10.3.13:8080/d1e516ca1d8b4d57a172dac786907a90/update/6?value=255

In above line u used value = 255? i mean to ON/OFF values we use ‘0’ or ‘1’ na?

update ‘6’ means u used D12 pin right?

I mean iam using this board


so to update D,D5,D6,D7 pins i should use GPIO pin values na like this below:

http://192.168.1.9:8080/80d3631030d247f0b4250eecc2410849/update/0?value=‘0’
The above line is to update D3 pin to ON it ,is this true?


#13

I was using a PWM pin and an Arduino, thus my choices of values and pin numbers…

Your choices will differ depending on what you want to do and what board you use.

Why are you still using quotes or apostrophes around your value?


#14

@Gunner
apoz for the Hijack, but I guess this will help the OP as well. I’ve never completely gotten my around thid but is this assumptions correct: ?

http://10.10.3.13:8080/xxxxxxx/update/6?value=255

updates gpio pin 6

http://10.10.3.13:8080/xxxxxxx/update/V6?value=255

updates virtual pin 6

http://10.10.3.13:8080/xxxxxxx/update/D6?value=255

updates digital pin D6 (depending on device compilation, e.g. for Wemos D6 = gpio 12)


#15

Once you fix the quotes, then yes… sorta… but what you are actually doing is setting pin 0 (D3) LOW or OFF (well OK, the LED may be wired to trigger ON when that pin is LOW)


#16

@gunner: we posted at the same time, can you have a look at my post?


#17

EDIT - OK, I am also confused… I was sure I had my Mega working with just using pin 6… but now I need to use D6 (different than ESP silkscreening)… and now it is not responding with PWM… so I guess I just don’t know for sure :blush:

Of course I also normally never use direct pin manipulation anyhow… instead I use vPins… so all I can say is use Trial and error, then go with whatever works :stuck_out_tongue:

I really don’t use the API myself… only when assisting others do I dig into how it works on their behalf… but I think I need to use it more myself so I have an even better understanding.


#18

I want to ON and OFF pin values so iam using 0 and 1 values


#19

Well, just keep trying different values and syntax… that’s all I was doing on your behalf :stuck_out_tongue_winking_eye: And may not be correct on some of my suggested syntax as I was not using an ESP in those tests.

But I have other things to focus on than learning API syntax right now, so I have to leave you to figure this out on your own for now.


#20

http://192.168.1.9:8080/80d3631030d247f0b4250eecc2410849/update/2?value=0
i executed this in browser but it showing wrong pin format.

Actually i connected my nodemcu boards to four bulbs of digital pins of D3,D5,D6,D7 and i want to update it by using 0 and 1 values for ON and OFF .above line i executed by placing 2 because D4 value of GPIO is 2 na so i placed it even it not executing


#21

If you wire your LEDs between the pin and ground, then 1 will be HIGH or ON, and 0 will be LOW or OFF