Asked — Edited

Lcd With Ez-B

hi i am new to ez-b and whole robotics world but i would like to add a lcd screen to ez-b i have no idea how to do it can someone explain how to do it from start and how enter scripts on lcd thanks


ARC Pro

Upgrade to ARC Pro

ARC Pro will give you immediate updates and new features needed to unleash your robot's potential!

United Kingdom
#9  

OK, I have sorted it out. I just needed to step back, have a coffee and then have another go (see how easy it is to blame the device when it was user error?).

The commands are;

CL = Clear Screen CS0 = Turn Off Cursor CS1 = Turn On Cursor BL0 = Turn Off Backlight BL1 = Turn On Backlight TP,x,y = Position Text. Example SendSerial(D14,9600,TP,3,1) - Top left = 0,0 bottom right = 15,1 TT = Text Entry 0 = Exit modes.

Quick Example, I will work on more now;


# LCD Script Examples
# Baud 9600
# Port D14

# Clear the screen and turn off the cursor and position top left
SendSerial(D14,9600,CL)
SendSerial(D14,9600,CS0)
Sleep(100)

# Display welcome message
SendSerial(D14,9600,TP,5,0)
SendSerial(D14,9600,TT)
SendSerial(D14,9600,"MELVIN")
SendSerial(D14,9600,0)
SendSerial(D14,9600,TP,4,1)
SendSerial(D14,9600,TT)
SendSerial(D14,9600,"START UP")
SendSerial(D14,9600,0)
Sleep(3000)

# Clear The Screen
SendSerial(D14,9600,CL)
Sleep(100)

# Position Some Text
SendSerial(D14,9600,TP,0,0)
SendSerial(D14,9600,TT)
SendSerial(D14,9600,"SAMPLE1")
SendSerial(D14,9600,0)
Sleep(100)
SendSerial(D14,9600,TP,0,1)
SendSerial(D14,9600,TT)
SendSerial(D14,9600,"SAMPLE2")
SendSerial(D14,9600,0)
Sleep(100)
Sleep(3000)

# Clear The Screen
SendSerial(D14,9600,CL)
Sleep(100)

# Animate Some Text
$posx = 0
:loop
SendSerial(D14,9600,CL)
SendSerial(D14,9600,TP,$posx,0)
SendSerial(D14,9600,TT)
SendSerial(D14,9600,"*")
SendSerial(D14,9600,0)
IF($posx<16)
  $posx=$posx+1
  Sleep(100)
  Goto(loop)
EndIf

Another example of how to make it do it's thing is;


SendSerial(D14,9600,CL,TP,2,0,TT,"Hello World",0)

That way saves having to write out all of the SendSerial lines.

United Kingdom
#10  

OK, spent the best part of today playing with this display and figured it all out now.

Positioning of text is simple when you think about it (I think I may have been getting mixed up on the X and Y)

However, one thing I've noticed and I hope someone can point me in the right direction or explain it is this...

If a servo is being held and SendSerial is executed the servo will twitch. Not every time but a lot of the time. I have my test bot displaying the current ping along with the current time on the display, updated every 500ms. The sweep servo is held at 20 but twitches every second or so.

Is it the display causing this or is it a general occurrence?

United Kingdom
#12  

That is the same one, same auction, same everything.

Simple to wire up


EZB     LCD     Colour
VCC     VCC     Red
GND     GND     Black
SIG     RX      White

Then plug it in to a digital port on the EZB

Excuse the poor quality it was taken quickly

User-inserted image

Just make sure it comes with an LCD, that picture is of just the "backpack" (or LCD driver)

United Kingdom
#14  

Example Script #1 (yes there will be more)


# LCD Script Examples
# Time Date

$baud=9600
$port=D14

# Clear the screen and turn off the cursor and position top left
SendSerial($port,$baud,CL,CS0,TP,0,0)
Sleep(100)

# Display welcome message
SendSerial($port,$baud,TP,3,0,TT,"EZ-Builder",0)
Sleep(500)
SendSerial($port,$baud,TP,3,1,TT,"Connected",0)
Sleep(1500)

# Time and Date
SendSerial($port,$baud,CL,TP,1,0,TT,"Time and Date",0)
Sleep(1500)
SendSerial($port,$baud,CL,TP,0,0,0)
# Display Time on Line 1
:loop
SendSerial($port,$baud,TP,6,0,TT,":",0)
# Format the time
# Convert to 12 hour
IF ($hour>12)
  $timehour=$hour-12
  SendSerial($port,$baud,TP,10,0,TT,"PM",0)
ELSE 
  IF ($hour=0)
    $timehour=12
  ENDIF 
  SendSerial($port,$baud,TP,10,0,TT,"AM",0)
ENDIF 
IF (Length($timehour)=1)
  SendSerial($port,$baud,TP,4,0,TT," ",0)  
  SendSerial($port,$baud,TP,5,0,TT,"$timehour",0)
ELSE 
  SendSerial($port,$baud,TP,4,0,TT,"$timehour",0)
ENDIF 
IF ($minute<10)
  SendSerial($port,$baud,TP,7,0,TT,"0",0)
  SendSerial($port,$baud,TP,8,0,TT,"$minute",0)
ELSE 
  SendSerial($port,$baud,TP,7,0,TT,"$minute",0)
ENDIF 

# Display Date on Line 2

# Format Date UK Style
IF ($day<10)
  SendSerial($port,$baud,TP,3,1,TT,"0$day/",0)
ELSE 
  SendSerial($port,$baud,TP,3,1,TT,"$day/",0)
ENDIF 
IF ($month<10)
  SendSerial($port,$baud,TT,"0$month/",0)
ELSE 
  SendSerial($port,$baud,TT,"$month/",0)
ENDIF 
SendSerial($port,$baud,TT,"$year",0)
WaitForChange($second)
SendSerial($port,$baud,TP,6,0,TT," ",0)
WaitForChange($second)
Goto(loop)

There may be a better way to format the time & date, I haven't spent long looking in to that but the above way works. It also updates every second with a blinking . which could be changed for every minute if it is eating up the communications.

As always, easy to change for your LCD, port and baud are variables at the top of the script.

As much for reference in to doing anything than as an example for making a clock.

Edit: Minor bug fix made to hour when changing to single digit would have left the leading 1.

United Kingdom
#16  

All code I post will work:)