Start a new topic

Send value of variable

I'm just lookin for a quick command to send a variable. If I have a multi array unsigned int mypins[5][10] = and I want to display the value of Mypins [0][4] into "t0" text box...how would I accomplish this? Thanks for the time.

No one knows how to do this? How about a simple NexText where on start up the box says "Hello"?

Hey Jesse,

It should be just this


This displays the number 4!

 

 

#include "Nextion.h"
NexText t0 = NexText(0, 1, "t0");
char buffer[100] = {0};
int Mypins [4][5] = {{0,1,2,3,4},{5,6,7,8,9},{10,11,12,13,14},{15,16,17,18,19}};
NexTouch *nex_listen_list[] = 
{
    NULL
};

void setup(void)
{
    nexInit();
}
void loop(void)
{
    nexLoop(nex_listen_list);

    uint16_t number;
    number = Mypins [0][4];
    memset(buffer, 0, sizeof(buffer));
    itoa(number, buffer, 10);
    t0.setText(buffer);
}

 Rod

 


Nope that did nothing. Type out just like above and it changed nothing on the screen.

It works. I tested it!

Did you put a text box on the screen?

Make sure the name is t0 for the text box.


Now just to be sure. you are using an Arduino to send this info to the screen?

I don't know, I'm starting to get real frustrated with this thing and don't understand it. Maybe something wrong the first time but I just tried again and it worked. I think I'm lost :(

Hi Jesse,

Ok this is how it works. You need to help us help you.

When somebody asks you what are you using and did you do this. Tell us. We aren't mind readers.

The best way to help is attach the files you are using. eg the HMI file for the screen, the Arduino ino.

Tell us exactly what your setup is, wiring detail, screen size etc. 

eg Arduino Uno, Arduino connected to pin 2 and 3.

Add a photo of your setup.

Tell us what library's on the Arduino you are using. what errors or not you are getting.


Give us something to work with!

Rod

Lol I'm trying everything, I'm using a mega with a ds1307 breakout. I want to integrate the screen into a piece of code for a reef controller but at the moment I'm trying to figure out how to change text fields and manipulate them to try and learn. The first time I tried your code I retyped it by looking at it on my phone. The time it worked I opened it up on my computer and copied and paste. There really is not much to the hmi file right now, just a text box with 1 page while I try and figure out what exactly I'm doing. Now that I have your example working in going to use that with iteads example to get the time to display. I'm taking baby steps with this whole thing.

Cool.

I had frustration with it too.

Have you checked out the smart fishtank tutorial?

http://blog.iteadstudio.com/nextion-tutorial-based-on-nextion-arduino-library/

it uses an RTC and has a lot of code you might be able to use


The problem I'm running into with this RTClib is that most of the sketches I have use the one posted by adafruit. The one the itead is using is a different RTClib and the 2 are not compatible. So to use my sketches I have to stick with the RTClib by adafruit while examples like smart fish tank are using the other RTClib. As an example trying to display the time using adafruit lib and itead exampel I get a invalid conversion from char to const char error. Amongst many others trying many kinds of things.

Bugger. I hate that when library's don't work together.

Send us an email. I'll see what I can do.

parsosmail@yahoo.com.au

Sent. Thank you.
Login or Signup to post a comment