Hello @ScruffR
Good day, I’m working with a “Particle electron” and a HMI “Nextion”, I’m trying to enter a numeric value “Setpoint”, but when I compile the following message is shown:
cannot convert ‘NexNumber’ to ‘double’ in assignment
In this section I register my variable that is n6:
void b0PopCallback(void *ptr);
void n6PopCallback(void *ptr);
void b1PopCallback(void *ptr);
void b2PopCallback(void *ptr);
void n7PopCallback(void *ptr);
void b3PopCallback(void *ptr);
void b4PopCallback(void *ptr);
NexNumber n0 = NexNumber(0, 10, "n0");
NexNumber n1 = NexNumber(0, 11, "n1");
NexNumber n2 = NexNumber(0, 12, "n2");
NexNumber n4 = NexNumber(0, 13, "n4");
NexNumber n5 = NexNumber(0, 14, "n5");
NexButton b0 = NexButton(0, 15, "b0");
NexNumber n6 = NexNumber(5, 12, "n6");
NexButton b1 = NexButton(5, 8, "b1");
NexButton b2 = NexButton(5, 9, "b2");
NexNumber n7 = NexNumber(5, 13, "n7");
NexButton b3 = NexButton(5, 10, "b3");
NexButton b4 = NexButton(5, 11, "b4");
char buffer[100] = {0};
NexTouch *nex_listen_list[] =
{
&n0,
&n1,
&n2,
&n4,
&n5,
&b0,
&n6,
&b1,
&b2,
&n7,
&b3,
&b4,
NULL
};
// BINARY INPUTS
void n6PopCallback(void *ptr)
{
dbSerialPrintln("n6PopCallback");
n6.setValue(3);
}
void b1PopCallback(void *ptr)
{
uint32_t number;
dbSerialPrintln("b1PopCallback");
n6.getValue(&number);
number += 1;
n6.setValue(number);
}
void b2PopCallback(void *ptr)
{
uint32_t number;
dbSerialPrintln("b2PopCallback");
n6.getValue(&number);
number -= 1;
n6.setValue(number);
}
/* Setpoint glycol differential */
void n7PopCallback(void *ptr)
{
dbSerialPrintln("n7PopCallback");
n7.setValue(3);
}
void b3PopCallback(void *ptr)
{
uint32_t number;
dbSerialPrintln("b3PopCallback");
n7.getValue(&number);
number += 1;
n7.setValue(number);
}
void b4PopCallback(void *ptr)
{
uint32_t number;
dbSerialPrintln("b4PopCallback");
n7.getValue(&number);
number -= 1;
n7.setValue(number);
}
plus everything else that my project takes.
and in this section is where I want to take the value that I enter from my HMI:
void updateSystemVariables(){
VAL_PRODUCT_TEMP = analogRead(IN_PRODUCT_TEMP);
// ***** invalid mapping range - just for testing
VAL_PRODUCT_TEMP = map(VAL_PRODUCT_TEMP, 0.0, 4095.0, -10.0, 50.0);
delay(5);
VAL_PRODUCT_SP = n6;
/* VAL_PRODUCT_SP = analogRead(IN_PRODUCT_TEMP_SP); */
// ***** invalid mapping range - just for testing
/* VAL_PRODUCT_SP = map(VAL_PRODUCT_SP, 0.0, 4095.0, -10.0, 50.0); */
delay(5);
VAL_GLYCOL_TEMP = analogRead(IN_GLYCOL_TEMP);
// ***** invalid mapping range - just for testing
VAL_GLYCOL_TEMP = map(VAL_GLYCOL_TEMP, 0.0, 4095.0, -10.0, 50.0);
delay(5);
VAL_GLYCOL_DIFF = n7;
/* VAL_GLYCOL_DIFF = analogRead(IN_GLYCOL_DIFF); */
/* VAL_GLYCOL_DIFF = map(VAL_GLYCOL_DIFF, 0.0, 4095.0, -10.0, 10.0); */
VAL_GLYCOL_SP = VAL_PRODUCT_SP + VAL_GLYCOL_DIFF;
if(VAL_GLYCOL_SP > 50){
VAL_GLYCOL_SP = 50;
}
if(VAL_GLYCOL_SP < -10){
VAL_GLYCOL_SP = -10;
}
}
I can not find how I can put the value or convert that value to be able to take it in my code.
thanks