Start a new topic

Nextion integer send to Arduino Due

Hi! 

How can i send value from Nextion to Arduino Due. For example, need to send value  (number--- integer) to arduino. I have nextion keypad. 

 I send number from nextion keypad to n0 box, and how now send this number to arduino?

 Arduino :

for(i=0,i<number, i++){

}




Nextion's keypad automatically sends to linked Component

Your keypad  ... via code.


Tnx, but i I did not explain well, I have Keyped noviskroz.hmi, want send  number from page tipkovnicako,if is Button b11 pressed to arduino for loop.  I tried, how is explained here http://support.iteadstudio.com/support/discussions/topics/11000011447 but doesn't work.

I have error message :( error: invalid conversion from 'int32_t {aka long int}' to 'uint32_t* {aka long unsigned int*}' [-fpermissive. )  

/**
 * @example CompButton.ino
 * 
 * @par How to Use
 * This example shows that when the button component on the Nextion screen is released,
 * the text of this button will plus one every time.      
 *
 * @author  Wu Pengfei (email:<pengfei.wu@itead.cc>)
 * @date    2015/7/10
 * @updated 2016/12/25 bring HMI up to v0.32 to avoid too old issues
 * @convert by Patrick Martin, no other changes made
 * @copyright 
 * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 */

#include "Nextion.h"

/*
 * Declare a button object [page id:0,component id:1, component name: "b0"]. 
 */

NexNumber n1 = NexNumber(0,1,"n1");
NexButton b13 = NexButton(0, 11, "b13");/*enter*/
char buffer[100] = {0};
int32_t mynumber;
byte ledPin = 13;
/*
 * Register a button object to the touch event list.  
 */
NexTouch *nex_listen_list[] = 
{
    
    &n1,
    &b13,
    NULL
};

/*
 * Button component pop callback function. 
 * In this example,the button's text value will plus one every time when it is released. 
 */

   
    
    

void b13PopCallback(void *ptr)
{
    
    
    NexButton *btn = (NexButton *)ptr;
    memset(buffer, 0, sizeof(buffer));
    btn->getText(buffer, sizeof(buffer));
     Serial.begin(9600);
  Serial.println("Starting StepperTest");
  digitalWrite(ledPin, LOW);
    delay(2000);
   pinMode(ledPin, OUTPUT);
  
NexNumber numonNextion(0,1,"n1");
numonNextion.getValue(mynumber);
 
  for (int i=0; i<mynumber; i++){
  
    digitalWrite(ledPin, HIGH);
    delayMicroseconds(500); // this line is probably unnecessary
    digitalWrite(ledPin, LOW);
    
    delay(500);
    
    digitalWrite(ledPin, !digitalRead(ledPin));
  }
  
 
}

void setup(void)
{    
    /* Set the baudrate which is for debug and communicate with Nextion screen. */
    nexInit();

    /* Register the pop event callback function of the current button component. */
    b13.attachPop(b13PopCallback, &b13);
     n1.attachPop(n1PopCallback,&n1);
    dbSerialPrintln("setup done"); 
}

void loop(void)
{   
    /*
     * When a pop or push event occured every time,
     * the corresponding component[right page id and component id] in touch event list will be asked.
     */
    nexLoop(nex_listen_list);
}










 

  

rar

I have error message :

( error: invalid conversion from 'int32_t {aka long int}' to 'uint32_t* {aka long unsigned int*}' [-fpermissive. )


So what does that message mean?

Should be : uint32_t* mynumber;


But now i have this error: 'n1PopCallback' was not declared in this scope

 

      n1.attachPop(n1PopCallback,&n1); 

so ... where is n1PopCallback declared?

NexNumber n1 = NexNumber(0,1,"n1");

void n1PopCallback(void *ptr)

{

dbSerialPrintln("n1PopCallback");

}


But now is : error ISO C++ forbids comparison between pointer and integer [-fpermissive]

and i understand that, how can now compare int and this mynumber? for (int i=0; i<mynumber; i++)

this is clerarly wrong.

&mynumber when get   mynumber when set

Login or Signup to post a comment