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
}