INTRODUCTION

 Nextion is a Human Machine Interface (HMI) solution ,In this tutorial we know how to download nextion software, To program nextion display and make LED on/off with the help of Arduino.

3.5inch NEXTION DISPLAY
model no. – NX4832K036_110
 USB TO UART TTL
5V, 3.3V FT232RL

  USB TO UART TTL 5V, 3.3V FT232RL

-We use usb to uart ttl to program our nextion display.

-There are 4 connections with nextion display.

-RX of usb to uart ttl is connected to TX of nextion display .

-TX of usb to uart ttl is connected to RX of nextion display .

-Vcc is connected to 5V.

-Gnd is connected to 0V

vcc-vcc
gnd-gnd
RX-TX
TX-RX

FOR DOWNLOAD NEXTION SOFTWARE

click here

CODE

int screenval[7];

int i = 0;

const int trigPin = 9;

const int echoPin = 10;

// defines variables

long duration;

int distance;

void setup()

{

  Serial.begin(9600);

 pinMode(13,OUTPUT);

 pinMode(trigPin, OUTPUT);

 pinMode(echoPin, INPUT);

}

void loop()                       

{

 if(Serial.available()>0){

  int x;

  x = Serial.read();

  Serial.println(x);

  screenval[i] = x;

  i++;

  if(i == 7){

i = 0;

if(screenval[2] == 1){

   digitalWrite(13,HIGH);

}

if(screenval[2] == 2){

   digitalWrite(13,LOW);

}

  }

 }// end of if condition

 digitalWrite(trigPin, LOW);

delayMicroseconds(2);

// Sets the trigPin on HIGH state for 10 micro seconds

digitalWrite(trigPin, HIGH);

delayMicroseconds(10);

digitalWrite(trigPin, LOW);

// Reads the echoPin, returns the sound wave travel time in microseconds

duration = pulseIn(echoPin, HIGH);

// Calculating the distance

distance= duration*0.034/2;

// Prints the distance on the Serial Monitor

/*Serial.print(“Distance: “);

Serial.println(distance);*/

Serial.print(“n0.val=”);

Serial.print(distance);

Serial.write(0xff);

Serial.write(0xff);

Serial.write(0xff);

delay(100);

}

VIDEO TUTORIAL

Click here

Categories: Uncategorized

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *