First function works great, second is not precise. I would use only one (first) function in code but I don't know how to call properly this function in loop. So I created second function and call it by
tarowanie();
but result isn't satisfied. What I'm doing wrong or how to call first function not by nextion event, just by myself?
Thx if somebody would read this and try to help me
Could it be that you are calling your routine too frequently? I see that there is an is_ready function in the library - perhaps it needs time to settle.
Also, why are you calling set_scale every time? I would have expected that to occur once.
#include <EEPROM.h>
void setup()
{
float a, b;
Serial.begin( 9600);
Serial.println();
Serial.println( "---- Test EEPROM.get ----");
// The EEPROM.put() can be commented out, when the EEPROM is written.
a = 123.45;
EEPROM.put( 8, a); // store 4 bytes at locations 8,9,10,11
a = 0.0;
EEPROM.get( 8, a);
Serial.print( "get by reference parameter: ");
Serial.println( a);
a = 0.0;
b = 0.0;
a = EEPROM.get( 8, b);
Serial.print( "get return value: ");
Serial.print( a);
Serial.print( ", reference parameter: ");
Serial.println( b);
a = 0.0;
a = EEPROM.get( 8, a);
Serial.print( "get by reference and return value are the same variable: ");
Serial.println( a);
}
void loop(){}
@bartek87, on this forum some say: "the problem is in the part that you are not showing". There is also a website for that: https://snippets-r-us.com/. Even when there is one line missing, then I keep wondering what would be in that line and how it might affect the sketch