File Exchange

image thumbnail

MATLAB Arduino LCD display System

version 1.0 (2.5 KB) by Jitendra Mishra
LCD display a message send by MATLAB to Arduino.

14 Downloads

Updated 03 Mar 2015

View License

This program is to connect Arduino with Computer and Display message on LCD send by MATLAB GUI.
Step 1.
Check the port address of arduino and edit the Serial command as required. Default port is COM3.

Upload below program in Arduino UNO or Mega
then Run MATLAB_ARDUINO_LCD .m code

#include <LiquidCrystal.h>

char mtlb_data; //MATLAB Data
int LCDcmd;
int row = 0;
int col = 0;
LiquidCrystal lcd(7,8,9,10,11,12);
//syntax :- lcd(RS,Enable,D4,D5,D6,D7);

void setup() {
// put your setup code here, to run once:
lcd.begin(16,2);
welcome();
lcd.blink();
//lcd.rightToLeft();
Serial.begin(115200);

}

void loop() {
// put your main code here, to run repeatedly:

if(Serial.available() > 0) //1st if open
{
while(Serial.available())
{
mtlb_data = Serial.read();
if(mtlb_data == '#')
{
lcd.clear();
welcome();
lcd.setCursor(1,1);
lcd.print(' ');
lcd.setCursor(0,1);
}
else
{
col++;
Serial.print(mtlb_data);
lcd.print(mtlb_data);
}
}

lcd.setCursor(--col,1);
lcd.print(' ');
lcd.setCursor(col,1);
}
}

void welcome()
{
col = 0; row = 0;
lcd.print("MATLAB and Arduino");
lcd.setCursor(col,++row);
}

Cite As

Jitendra Mishra (2021). MATLAB Arduino LCD display System (https://www.mathworks.com/matlabcentral/fileexchange/49901-matlab-arduino-lcd-display-system), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (5)

Justin Primero

Do you know how I can use this in an I2C LCD?

darryl tan

good code for lcd display. Do u know how to send text direct without press any buttons?

Daim Siddiqui

Please provide the pin connection of LCD with Arduino..!

Jackson

may i know this type of package can help me to make LED to blink or to run a motor at the same time display something on LCD>?

Cómo puedo agregar la libreria de 'LiquidCrystal' a Matlab.
Mi código es el siguiente:

clear all, clc
global a
a=arduino('COM7');
a.include<LiquidCrystal.h>
a.LiquidCrystal lcd(12,11,5,4,3,2);
a.lcd.begin(16,2);

MATLAB Release Compatibility
Created with R2012a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

MATLAB ARDUINO LCD/