Hi Robin2
Ok code amended.
I am now on the serial monitor getting a 0 or a -18 when I send the line of code through.
But I am not getting ANY change on the nextion screen........
even if I comment out the //Serial.println (AHVal); so that the next line is Serial2.print("j2.val=");and then
Serial2.print (AHVal);
Am I missing something?
AHVal has been declared.
void showNewData() {
if (newData == true) {
//Serial.print("This just in ... ");
AHVal = atoi(receivedChars); //convert to int
AHBarValue = map (AHVal, 0, -30, 100, 0);
Serial.println(AHVal);
Serial2.print ("j2.val=");
Serial2.print (AHVal);
Serial2.print (0xff);
Serial2.print (0xff);
Serial2.print (0xff);
newData = false;
Can you help me here.....?
Regards
Charles
Robin2
October 31, 2019, 1:14pm
22
Charles_Gibbs:
I am now on the serial monitor getting a 0 or a -18 when I send the line of code through.
Is that correct?
Sorry, I know nothing about Nextion screens. Are you able to show "hello world" with a very simple program?
...R
Robin2:
Is that correct?
Um? after putting it through through the atoi, that's what it gives me so I would presume so it takes away the first 2 zero's it would seem.....
if you concur then I'll mark this post as solved, I have posted under Perry Beddingtons post, I'll see if he answers me.
Thanks for your help Robin..
Regards
Charles
Robin2
October 31, 2019, 4:36pm
24
Charles_Gibbs:
Um? after putting it through through the atoi, that's what it gives me so I would presume so it takes away the first 2 zero's it would seem.....
Is it producing the values that have been sent to the Arduino?
There should be no "UM?" about that - it is, or it isn't.
...R
Hi Robin.
It is producing the values.
Since I put in the atoi line that is how it is being produced, so I presume that that is right...
I have since found that I am able to say AHVal = -AHVal;
Then it swings the numbers positive in the serial monitor.
I now have to get the map function working.
But I now have positive numbers and not negative ones.
It should make life easier.......
thank you for your help.
regards
Charles