Hello. Im currently doing a soil moisture sensor simulation with Arduino Uno on Proteus. I’d converted the pin value into a range of number using map function.
const int drysoil = 1023;
const int wetsoil = 0;
moist = analogRead(MoistPin);
int percentageMoisture = map(moist, wetsoil, drysoil, 100, 0);
So far, my coding is working fine as the LCD is showing the value from percentageMoisture . However, I would like to connect it to Blynk and I want Blynk to show the data from percentageMoisture on the dashboard instead of reading pin value.
May I know to which example of Blynk 2.0 I need to refer to do this simulation? Thanks 
Set-up a virtual pin datastream with range of 0-100 then use Blynk.virtualWrite(your-virtual-pin-number, percentageMoisture)
Take care not to write data to the virtual pin in the void loop. Use a timed function instead.
Pete.
1 Like
Thanks! I already tried it and it working great! However, I just put in void loop. May I know what do u mean by timed function and the effect if use in void loop?
I understand now, Pete. Thanks for you help! 
If you dont mind, can Blynk show the status of the output (not controlling them)? For eg; an output activating a relay to activate the motor. So, if the output=HIGH, relay turn on and activate the motor. I would like the Blynk to show the status of the Output either it is HIGH (motor on) or LOW (motor off)
Yes, you could use an LED widget for that. The LED widget takes its minimum/maximum brightness from the datastream configuration. If you define a datastream with range 0-255 then you need to write a 255 to the LED widget to achieve maximum brightness, 127 for half brightness, o for off etc.
If you define the datastream as 0-1 then 0=off and 1 = on at full brightness.
It’s all in the documentation if you take the time to read it.
Pete.
Thanks Pete! Its all clear now. I greatly appreciated your help and explanations 
1 Like