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

"numeric input" acts weird. Or is it just me?


#1

Hi,

I noticed that when I input the value to “numeric input” by using the “keyboard” (without using the - and +), it doesn´t update the variable to hardware. By using those - and + Blynk updates the variable just fine. Code was too long here so i left important stuff only.

-NodeMcu1.0 / ESP8266
-Android 8.1.0
-Blynk Server
-Blynk Library ver. 0.6.1


#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <TimeLib.h>
#include <WidgetRTC.h>
#include <SPI.h>
SimpleTimer timer;
WidgetRTC rtc;
WidgetTerminal terminal(V3);
#define server "blynk.cloud-com"   // or "blynk.cloud-com" for Blynk's cloud server
char Date[16];
char Time[16];
char auth[] = "++++";
char ssid[] = "++++";
char pass[] = "++++";
long startsecondswd;            // weekday start time in seconds
long stopsecondswd;             // weekday stop  time in seconds
long nowseconds;                // time now in seconds
bool isFirstConnect = true;

unsigned long DrainValvePeriod = 0;  //Set Drain Valve Open Time

unsigned long PumpAVPeriod = 0;  //Fertilizer Pump 1 Fertilizer A (GROW) ON Vegetative State period
unsigned long PumpBVPeriod = 0;  //Fertilizer Pump 2 Fertilizer B (BLOOM) ON Vegetative State period
unsigned long PumpCVPeriod = 0;  //Fertilizer Pump 3 Fertilizer C (MICRO) ON Vegetative State period

unsigned long PumpABPeriod = 0;  //Fertilizer Pump 1 Fertilizer A (GROW) ON BLOOM 1 State period
unsigned long PumpBBPeriod = 0;  //Fertilizer Pump 2 Fertilizer B (BLOOM) ON BLOOM 1 State period
unsigned long PumpCBPeriod = 0;  //Fertilizer Pump 3 Fertilizer C (MICRO) ON BLOOM 1 State period

unsigned long PumpABFPeriod = 0;  //Fertilizer Pump 1 Fertilizer A (GROW) ON BLOOM 2 State period
unsigned long PumpBBFPeriod = 0;  //Fertilizer Pump 2 Fertilizer B (BLOOM) ON BLOOM 2 State period
unsigned long PumpCBFPeriod = 0;  //Fertilizer Pump 3 Fertilizer C (MICRO) ON BLOOM 2 State period



void setup()
{



  pinMode(RELAY1, OUTPUT);
  pinMode(RELAY2, OUTPUT);
  pinMode(RELAY3, OUTPUT);
  pinMode(RELAY4, OUTPUT);
  pinMode(RELAY5, OUTPUT);
  pinMode(RELAY6, OUTPUT);
  pinMode(RELAY7, OUTPUT);
  digitalWrite(RELAY1, LOW); // set Main Valve OFF
  digitalWrite(RELAY2, LOW); // set LIGHTS OFF
  digitalWrite(RELAY3, LOW); // set Fertilizer Pump 1 GROW OFF
  digitalWrite(RELAY4, LOW); // set Fertilizer Pump 2 BLOOM OFF
  digitalWrite(RELAY5, LOW); // set Fertilizer Pump 3 MICRO OFF
  digitalWrite(RELAY6, LOW); // set Drain Valve OFF
  digitalWrite(RELAY7, LOW); // set Water Pump OFF

  pinMode(ultraSoundSignal, OUTPUT);
  pinMode(ultraSoundSignalIN, INPUT);  Serial.begin(115200);
  Serial.println("\Starting");
  Blynk.begin(auth, ssid, pass, IPAddress(139, 59, 206, 133), 80);
  int mytimeout = millis() / 1000;

  WaterPumpStartMillis = millis();  //initial start time of Water Pump

  while (Blynk.connect() == false) { // try to connect to server for 10 seconds
    if ((millis() / 1000) > mytimeout + 8) { // try local server if not connected within 9 seconds
      break;
    }
  }
  rtc.begin();
  timer.setInterval(10000L, activetoday);  // check every 10 SECONDS if schedule should run today
  timer.setInterval(30000L, reconnectBlynk);  // check every 30s if still connected to server
  timer.setInterval(5000L, clockvalue);  // check value for time
  timer.setInterval(5000L, sendWifi);    // Wi-Fi singal
  timer.setInterval(1000L, ultrasoundsensor_send); //ultrasoundsensorvalue
  timer.setInterval(2000L, MoistureSensor); // Moisture Sensor Value
}

BLYNK_WRITE(V6)  //Water Capacity Value Input
{
  int capacityValueIn = param.asInt(); //Get value as integer
  capacityAdjustValue = capacityValueIn * 100.00 / 10000.00; //Calculate User Water Capacity Adjusting Value
}

BLYNK_WRITE(V9)  //Drain Time Value Input
{
  int DrainTimeValueIn = param.asInt(); //Get value as integer
  DrainValvePeriod = DrainTimeValueIn * 60000;  //Calculate User Drain Time Value

}


BLYNK_WRITE(V14)  //Vegetative State Fertilizer A (Grow) Value Calculations
{
  int VegFertAValueIn = param.asInt(); //Get value as integer
  float VegFertAAdjustValue = VegFertAValueIn * 100.00 / 10000.00; //Calculate User Vegetative State Fertilizer A (Grow) Adjusting Value
  PumpAVPeriod = (VegFertAAdjustValue * 55000) * capacityAdjustValue; //Calculate User Vegetative State Fertilizer A (Grow) Output Value (55000 = 100Ml)
}

BLYNK_WRITE(V15)  //Vegetative State Fertilizer B (Bloom) Value Calculations
{
  int VegFertBValueIn = param.asInt(); //Get value as integer
  float VegFertBAdjustValue = VegFertBValueIn * 100.00 / 10000.00; //Calculate User Vegetative State Fertilizer B (Bloom) Adjusting Value
  PumpBVPeriod = (VegFertBAdjustValue * 55000) * capacityAdjustValue; //Calculate User Vegetative State Fertilizer B (Bloom) Output Value (55000 = 100Ml)
}

BLYNK_WRITE(V16)  //Vegetative State Fertilizer C (Micro) Value Calculations
{
  int VegFertCValueIn = param.asInt(); //Get value as integer
  float VegFertCAdjustValue = VegFertCValueIn * 100.00 / 10000.00; //Calculate User Vegetative State Fertilizer C (Micro) Adjusting Value
  PumpCVPeriod = (VegFertCAdjustValue * 55000) * capacityAdjustValue; //Calculate User Vegetative State Fertilizer C (Micro) Output Value (55000 = 100Ml)
}


//Bloom 1 State Fertilizer Calculations


BLYNK_WRITE(V17)  //Bloom 1 State Fertilizer A (Grow) Value Calculations
{
  int Bloom1FertAValueIn = param.asInt(); //Get value as integer
  float Bloom1FertAAdjustValue = Bloom1FertAValueIn * 100.00 / 10000.00; //Calculate User Bloom 1 State Fertilizer A (Grow) Adjusting Value
  PumpABPeriod = (Bloom1FertAAdjustValue * 55000) * capacityAdjustValue; //Calculate User Bloom 1 State Fertilizer A (Grow) Output Value (55000 = 100Ml)
}

BLYNK_WRITE(V18)  //Bloom 1 State Fertilizer B (Bloom) Value Calculations
{
  int Bloom1FertBValueIn = param.asInt(); //Get value as integer
  float Bloom1FertBAdjustValue = Bloom1FertBValueIn * 100.00 / 10000.00; //Calculate User Bloom 1 State Fertilizer B (Bloom) Adjusting Value
  PumpBBPeriod = (Bloom1FertBAdjustValue * 55000) * capacityAdjustValue; //Calculate User Bloom 1 State Fertilizer B (Bloom) Output Value (55000 = 100Ml)
}

BLYNK_WRITE(V19)  //Bloom 1 State Fertilizer C (Micro) Value Calculations
{
  int Bloom1FertCValueIn = param.asInt(); //Get value as integer
  float Bloom1FertCAdjustValue = Bloom1FertCValueIn * 100.00 / 10000.00; //Calculate User Bloom 1 State Fertilizer C (Micro) Adjusting Value
  PumpCBPeriod = (Bloom1FertCAdjustValue * 55000) * capacityAdjustValue; //Calculate User Bloom 1 State Fertilizer C (Micro) Output Value (55000 = 100Ml)
}

//Bloom 2 State Fertilizer Calculations


BLYNK_WRITE(V20)  //Bloom 2 State Fertilizer A (Grow) Value Calculations
{
  int Bloom2FertAValueIn = param.asInt(); //Get value as integer
  float Bloom2FertAAdjustValue = Bloom2FertAValueIn * 100.00 / 10000.00; //Calculate User Bloom 2 State Fertilizer A (Grow) Adjusting Value
  PumpABFPeriod = (Bloom2FertAAdjustValue * 55000) * capacityAdjustValue; //Calculate User Bloom 2 State Fertilizer A (Grow) Output Value (55000 = 100Ml)
}

BLYNK_WRITE(V21)  //Bloom 2 State Fertilizer B (Bloom) Value Calculations
{
  int Bloom2FertBValueIn = param.asInt(); //Get value as integer
  float Bloom2FertBAdjustValue = Bloom2FertBValueIn * 100.00 / 10000.00; //Calculate User Bloom 2 State Fertilizer B (Bloom) Adjusting Value
  PumpBBFPeriod = (Bloom2FertBAdjustValue * 55000) * capacityAdjustValue; //Calculate User Bloom 2 State Fertilizer B (Bloom) Output Value (55000 = 100Ml)
}

BLYNK_WRITE(V22)  //Bloom 2 State Fertilizer C (Micro) Value Calculations
{
  int Bloom2FertCValueIn = param.asInt(); //Get value as integer
  float Bloom2FertCAdjustValue = Bloom2FertCValueIn * 100.00 / 10000.00; //Calculate User Bloom 2 State Fertilizer C (Micro) Adjusting Value
  PumpCBFPeriod = (Bloom2FertCAdjustValue * 55000) * capacityAdjustValue; //Calculate User Bloom 2 State Fertilizer C (Micro) Output Value (55000 = 100Ml)
}

Something wrong with the Blynk-app or something wrong with me?

Does anyone know something about this “value input”-issue?

Thanks.

,Tomi


#2


#3

Sorry bout this. Just didn´t notice


#4

There’s an iOS Numeric Input Widget issue, but it’s different from what you’ve described and you’re on Android.

So one or more of the BLYNK_WRITE macros corresponds to a Numeric Input Widget? And none of the BLYNK_WRITE macros are being invoked when you enter a value using the keyboard? You mentioned “it doesn´t update the variable to hardware”. I assume the variable(s) in question are capacityAdjustValue, DrainValvePeriod, … Have you verified the BLYNK_WRITE macros aren’t being invoked (by using a Serial.println)?

I’m not running iOS, so I can’t verify the behavior one way or the other. Someone else will need to chime in.

Joe


#5

Yes, I checked this thing by using Serial.println. variables are those you mentioned. None of them are invoked when i use the keyboard. Only by using + or - those work.

,Tomi


#6

I can’t test if for you, because I don’t have an Android device.

If you want others to test if for you then I think you need to post code that’s capable of being compiled, and either a QR code to a clone of the project, or some information about what the various widgets are that you’ve used and how the app is supposed to function.

Pete.


#7

are you serious? Just add “numeric input”- widget and test it with serial.println. Why do you need my code to test that? code is too large here anyway, so if someone tests it i´d rather send it to his/her e-mail. Ok? Give me an e-mail where to send it and iĺl do if you really need it… but i think you dont.


#8

Can someone running Android please help @Lobotomi? Where’s @Gunner? He’s an Android guy, right?


#9

Now when I thought about this itś actually impossible for others to test this with my code and my project. You will need an Ultrasonic distance sensor to start hydroponic watering and only then these “numeric inputs” is used. So I need to modify my code quite a lot that you can test it.

So if you please first test it by using only “numeric input”-widget and Serial.println… It doesn´t take long compared to that I need to modify my code for you to test it.

Thanks

,Tomi


#10

Can you check Android beta 2.27.2? It has some changes for the way the entered value will be sent to hardware (on keyboard close)


#11

Can you say where can I find that version? How to do it?


#12

Open Blynk app’s page in Play Store app and scroll it to the section “Join the beta”


#13

I have Blynk version 2.27.2 now and problem is solved. That´s great ! . There really was some problem with “numeric input” in that other version. Should you do something about it? But I´m happy that this version works like it should now. Big thanks to BlynkAndroidDev.

,Tomi


#14

I plan to release it tomorrow into production, just finishing some issues check.


#15

Btw… would be nice to be able to use steps with decimals in that “numeric input”. Too late to add that kind of feature?

,Tomi


#16

You should be able to add decimals there for virtual pins.


#17

Oh yes seems to be by using that “keyboard”. But I thought the actual “+ and - steps” could be with decimals (like 0.1). So when pressing + or - it for ex. adds 0.1 to the value everytime. Now when I input for ex. that 0.1 by using that keyboad and then press + the value is 1.1… So if those + and - could could use for ex. 0.1 steps. Hopefully you understood what I meant.

But its not so big problem there. But still… Would be nice.

Thanks anyway.

,Tomi


#18

I still say the Numeric Input Widget would work better looking and acting as a standard numeric keypad (about the size of the Joystick or 1/4 screen)… and just as intuitively usable as one would expect it to be with whole or decimal numbers.


#19

Do you mean pressing +/- while the keyboard is open? It could work in such way as it is likely not finished editing, so the widget assumes old value - I’ll check


#20

Doesn’t the Step Widget (H or V) already do exactly that… I have used it as such.

Edit, or are you looking for on the fly adjustment (AKA sharing accessible) of the decimal or value?