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

Mapping analog input over 9,999 units

Hello! I want to know if it’s possible mapping analog input over 9999 units, the value display widget can map values up to 9999 units and I need 13000 units. I know that I can use a virtual pin and map it:

Entrada2 = analogRead(A2);
FOXR = map(Entrada2,0,4095,0,13000);
Blynk.virtualWrite(V2,FOXR);

But I dont know why the widget display used with a virtual pin doesn´t changes as i need, some times it freezes with the same value during a long time. For that reason i want to map an analog input on the widget with values over 9999 units.

I’m using Particle electron with GSM communications, Blynk is working on Android 9. Blynk server is used. Blynk Library version is 0.6.3.

This is the code.

#define BLYNK_IP        IPAddress(45,55,130,102)


#define BLYNK_HEARTBEAT 60/
#define PARTICLE_KEEPALIVE 20

#include <blynk.h>
char auth[] = "xxxxxxxxxx";

int PGN;
int FGN;
int FOXR;
int FOXP;
int POX;
BlynkTimer timer;

void Escalamiento()
{
    int Entrada0 = analogRead(A0);
    PGN = map(Entrada0,0,4095,-25,225);
    Blynk.virtualWrite(V0,PGN);  
    
    int Entrada1 = analogRead(A1);
    FGN = map(Entrada1,0,4095,0,10000);
    Blynk.virtualWrite(V1,FGN);
    
    int Entrada2 = analogRead(A2);
    FOXR = map(Entrada2,0,4095,0,12988);
    Blynk.virtualWrite(V2,FOXR);
    
    int Entrada3 = analogRead(A3);
    FOXP = map(Entrada3,0,4095,0,12988);
    Blynk.virtualWrite(V3,FOXP);
    
    int Entrada4 = analogRead(A4);
    POX = map(Entrada4,0,4095,0,290);
    Blynk.virtualWrite(V4,POX);      
}

void setup()
{
  // Debug console
  Serial.begin(9600);           
  delay(2000);                

  Particle.keepAlive(PARTICLE_KEEPALIVE);
  Blynk.begin(auth, BLYNK_IP);
  timer.setInterval(1000L, Escalamiento);
}

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