My program:
#define BLYNK_PRINT DebugSerial
int val;
float lux=0.00,ADC_value=0.0048828125,LDR_value;
// You could use a spare Hardware Serial on boards that have it (like Mega)
#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(2, 3); // RX, TX
#include <BlynkSimpleStream.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "lENO2Pj-R5EbUCf-eqD1bNiqhmS1UmCI";
void setup()
{
// Debug console
DebugSerial.begin(115600);
pinMode(A0,INPUT);
pinMode(A1,INPUT);
// Blynk will work through Serial
// Do not read or write this serial manually in your sketch
Serial.begin(115600);
Blynk.begin(Serial, auth);
}
void loop()
{
val = analogRead(A0);
float mv = ( val/1024.0)*5000;
float cel = mv/10;
float farh = (cel*9)/5 + 32;
Blynk.virtualWrite(V0,cel);
Blynk.virtualWrite(V1,farh);
Serial.print("TEMPRATURE = ");
Serial.print(cel);
Serial.print("*C");
Serial.println();
LDR_value=analogRead(A1);
lux=(250.000000/(ADC_value*LDR_value))-50.000000;
Serial.println(lux);
Blynk.virtualWrite(V2,lux);
Blynk.run();
}
My serial connection:
Connecting device at COM6 to blynk-cloud.com:80…
OpenC0C("\.\COM6", baud=115600, data=8, parity=no, stop=1) - OK
Connect(“blynk-cloud.com”, “80”) - OK
InOut() START
DSR is OFF
Arduino Uno connected to my pc
pc connected to same network of mobile
Problem:Reading in Blynk app get updated only once(If the reading was 95 at starting it keeps on the same its not updating over time.)