How can I display variables on an LCD screen using printLCD(lcd,) ?

조회 수: 38 (최근 30일)
Jonathon Staggs
Jonathon Staggs 2021년 4월 14일
댓글: Izza 2023년 12월 3일
I can display strings on my LCD using the matlab function printLCD(lcd,'Hello World') but I cannot define x = 123 and printLCD(lcd,x)
  댓글 수: 4
Izza
Izza 2023년 12월 3일
hello! this doesn't work for me for some reason, i tried printing x=123, but it printed a hashtag instead, could you help me out?

댓글을 달려면 로그인하십시오.

답변 (2개)

Shadaab Siddiqie
Shadaab Siddiqie 2021년 4월 29일
From my understanding you are not able to run printLCD(lcd,123). This might be because second argument of the printLCD must be a string. you can refer create LCD add-on for more information.
  댓글 수: 1
Walter Roberson
Walter Roberson 2023년 3월 11일
function printLCD(obj,message)
cmdID = obj.LCD_PRINT;
if numel(message) > 16
error('Cannot print more than 16 characters')
end
With the error talking about characters it follows that message is expected to be a character vector, not a string() scalar.

댓글을 달려면 로그인하십시오.


Pradeep Gopalsamy
Pradeep Gopalsamy 2022년 6월 9일
Hello Friends I need a help to display t=0, 'speed'= 0 in LCD display in same row Arduino board.
  댓글 수: 1
Walter Roberson
Walter Roberson 2023년 3월 11일
t = 0; speed = 0;
msg = sprintf('t=%.1f, speed=%.1f', t, speed);
printLCD(lcd, msg);
Watch out for the 16 character limit.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Arduino Hardware에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by