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

HTTP get -- returned value of virtual pin always the same

I am using an arduino uno with a photo resistor and HC-10 bluetooth module.
The photo resistor writes values between 0 and 34 successfully to the serial monitor.

I have the latest version of the blynk app on my ipad with a display widget.
The app connects successfully via bluetooth to my arduino and displays the photo resistor values correctly to V5.

When I try these restful api calls from the browser:
https://blynk-cloud.com/c-fw8Zxp97quzceim6CcRGIIxRj-ZLve/get/V5
https://45.55.96.146/c-fw8Zxp97quzceim6CcRGIIxRj-ZLve/get/V5

It always returns a value of 34, regardless of the value being shown in the serial monitor or on the display widget on the app.

Can someone please help? Thank you!!


const int sensorPin = A0;

#define BLYNK_PRINT Serial

int lightVal;

#include <SoftwareSerial.h>
SoftwareSerial SerialBLE(6, 7); //Rx, Tx

#include <BlynkSimpleSerialBLE.h>
char auth[] = "c-fw8Zxp97quzceim6CcRGIIxRj-ZLve";

BlynkTimer timer;

void myTimerEvent()
{
  lightVal = analogRead(sensorPin);
  Blynk.virtualWrite(V5, lightVal);
}

void setup()
{
  Serial.begin(9600);
  SerialBLE.begin(9600);
  Blynk.begin(SerialBLE, auth);
  // Setup a function to be called every second
  timer.setInterval(1000L, myTimerEvent);
}


void loop()
{
  Serial.println(lightVal);
  Blynk.run();
  timer.run(); // Initiates BlynkTimer

}

Try : get/V5?value=%s

thank you so much for responding Blynk_Coeur

I had remade the blynk app and although I still can see the values changing on the value display widget and the super graph, I cannot get values returned from the api calls.

here is what I get from:
http://blynk-cloud.com/orDlOJTNg1yaj41ahyKCKz3rh8FZFP8O/project

{“id”:972684885,“parentId”:-1,“isPreview”:false,“name”:“light 3”,“createdAt”:1610541198800,“updatedAt”:1610541644963,“widgets”:[{“type”:“BLUETOOTH”,“id”:1070786271,“x”:0,“y”:0,“color”:600084223,“width”:2,“height”:1,“tabId”:0,“isDefaultColor”:true,“deviceId”:0},{“type”:“DIGIT4_DISPLAY”,“id”:1944356380,“x”:2,“y”:0,“color”:600084223,“width”:2,“height”:1,“tabId”:0,“label”:“light”,“isDefaultColor”:true,“deviceId”:0,“pinType”:“VIRTUAL”,“pin”:5,“pwmMode”:false,“rangeMappingOn”:false,“min”:0.0,“max”:1023.0,“frequency”:0,“fontSize”:“MEDIUM”},{“type”:“ENHANCED_GRAPH”,“id”:3076365,“x”:0,“y”:1,“color”:600084223,“width”:8,“height”:3,“tabId”:0,“isDefaultColor”:true,“dataStreams”:[{“graphType”:“LINE”,“color”:600084223,“targetId”:0,“pin”:{“pin”:5,“pwmMode”:false,“rangeMappingOn”:false,“pinType”:“VIRTUAL”,“min”:0.0,“max”:1023.0},“functionType”:“SUM”,“flip”:511,“yAxisMin”:0.0,“yAxisMax”:100.0,“showYAxis”:false,“cubicSmoothingEnabled”:false,“connectMissingPointsEnabled”:true,“isPercentMaxMin”:true,“yAxisScale”:“AUTO”,“delta”:0.0,“userDeltaModifyAllowed”:false,“maximumFractionDigits”:-1}],“textAlignment”:“LEFT”,“fontSize”:“MEDIUM”,“showTitle”:true,“showLegend”:true,“yAxisValues”:false,“xAxisValues”:false,“showXAxis”:false,“allowFullScreen”:true,“overrideYAxis”:false,“hideGradient”:false,“yAxisMin”:0.0,“yAxisMax”:0.0,“isPercentMaxMin”:false,“selectedPeriods”:[“LIVE”,“ONE_HOUR”,“SIX_HOURS”,“N_DAY”,“N_WEEK”,“N_MONTH”,“N_THREE_MONTHS”]}],“devices”:[{“id”:0,“name”:“light 3”,“boardType”:“Arduino UNO”,“vendor”:“light 3”,“connectionType”:“BLUETOOTH”,“isUserIcon”:false}],“theme”:“Blynk”,“keepScreenOn”:false,“isAppConnectedOn”:false,“isNotificationsOff”:false,“isShared”:false,“isActive”:true,“widgetBackgroundOn”:false,“color”:-1,“isDefaultColor”:true}

and when I try:
http://blynk-cloud.com/orDlOJTNg1yaj41ahyKCKz3rh8FZFP8O/get/V5?value=%s

it gives me:
[]

brackets with no data

/project give you the project store on blynk server, that’s normal
do you have a value on your V5 virtual object on the app phone ?
I assume V5 is a label?
that works for me with get command
Blynk.virtualWrite(V5, fuel_level); // V5 as a label
http://192.168.0.100:8088/csGgCSVMLY4p4dTTR21pvLsV4/get/V5?value=%s
2021-01-13_155552