Hi all, I just received a Nextion 3.2" display. I have it connected up to my Teensy 3.2 to pins 0 and 1. Nextion Tx --> Teensy Rx pin 0 and Nextion Rx --> Teensy Tx pin 1.
I get no communication between the two. I have even unplugged the USB from Windows and used a simple USB wall adapter for the devices. This did nothing. Do I need to define the Serial port in the sketch?
Below is the Nextion sample;
I tried making some changes like so with no joy;
Looking through some of the Nextion info it appears they say to define your serial port in the NexSerialConfig.h, but I was thinking that's only to turn off debugging.
I get no communication between the two. I have even unplugged the USB from Windows and used a simple USB wall adapter for the devices. This did nothing. Do I need to define the Serial port in the sketch?
Below is the Nextion sample;
Code:
/**
* @example CompButton.ino
*
* @par How to Use
* Show how to use API of class NexButton.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/7/10
* @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"
NexButton b0 = NexButton(0, 1, "b0");
char buffer[100] = {0};
NexTouch *nex_listen_list[] =
{
&b0,
NULL
};
void b0PopCallback(void *ptr)
{
uint16_t len;
uint16_t number;
NexButton *btn = (NexButton *)ptr;
dbSerialPrintln("b0PopCallback");
dbSerialPrint("ptr=");
dbSerialPrintln((uint32_t)ptr);
memset(buffer, 0, sizeof(buffer));
btn->getText(buffer, sizeof(buffer));
number = atoi(buffer);
number += 1;
memset(buffer, 0, sizeof(buffer));
itoa(number, buffer, 10);
btn->setText(buffer);
}
void setup(void)
{
nexInit();
b0.attachPop(b0PopCallback, &b0);
dbSerialPrintln("setup done");
}
void loop(void)
{
nexLoop(nex_listen_list);
}
I tried making some changes like so with no joy;
Code:
/**
* @example CompButton.ino
*
* @par How to Use
* Show how to use API of class NexButton.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/7/10
* @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"
NexButton b0 = NexButton(0, 1, "b0");
char buffer[100] = {0};
NexTouch *nex_listen_list[] =
{
&b0,
NULL
};
void b0PopCallback(void *ptr)
{
uint16_t len;
uint16_t number;
NexButton *btn = (NexButton *)ptr;
Serial.println("b0PopCallback");
Serial.print("ptr=");
Serial.println((uint32_t)ptr);
memset(buffer, 0, sizeof(buffer));
btn->getText(buffer, sizeof(buffer));
number = atoi(buffer);
number += 1;
memset(buffer, 0, sizeof(buffer));
itoa(number, buffer, 10);
btn->setText(buffer);
}
void setup(void)
{
Serial.begin(9600);
nexInit();
b0.attachPop(b0PopCallback, &b0);
Serial.println("setup done");
}
void loop(void)
{
nexLoop(nex_listen_list);
}
Looking through some of the Nextion info it appears they say to define your serial port in the NexSerialConfig.h, but I was thinking that's only to turn off debugging.