Home Resources
 

Lessons from BOB : PART ONE

 DRAWING THE FACE

 

avb_profile.png

Remember BOB from one of our projects? Well, it got so popular we had to make up tutorials on how we did it. It’s pretty easy with all the libraries we wrote to get it up. 

 

Items used in this tutorial:

  • FlamingICE80
  • GLCD + RTC Combo Module
  • FICE SD Card
  • Singular IO Adapter
  • FI Comm.Key
  • 6V Power Supply
  • A couple of pluggable female to female connectors
  • 3 Servo Motors
  • Avril Le Bob Robotic Base

 

HARDWARE CONFIGURATION

 

 AVRIL LE BOB_small.png

 click for enlarged image

 

THE GRAPHIC LCD (GLCD)

 Before using the GLCD, it must be initialised and we recommend making the whole screen white. The following code does just that.

 

CODE:

 

OS.GLCD.Init()

OS.GLCD.Fill(255)

 


 

Images can now be drawn onto the GLCD.  To simplify the process of getting the project up, we shall make use of the images that are already stored in the FICE SD card.  The images are as follows:

 

IMAGES STORED IN THE SD CARD

images_SD.png

 

TECHNICAL OVERVIEW

 GLCD_FACE.png

 

A library has also been written to draw these images. Locate and include the DRAW_LIB library into your project (Project > Add Module). The following are subroutines found in the DRAW_LIB library:

 

CODE:

 

 DRAW_EYE(ByVal X As Integer, ByVal Y As Integer, ByVal OPEN As Boolean)

 

 

DRAW_EYE takes 3 arguments. The X and Y determines the position of the eye to be drawn and OPEN determines if the eye should be drawn using image EYE_OPEN or EYE_CLOSE. Type ‘True’ to draw EYE_OPEN and ‘False’ to draw EYE_CLOSE.

Let’s add the following line of code to draw two eyes on the GLCD.

 

CODE:

 

DRAW_EYE(25, 70, True)

DRAW_EYE(75, 70, True)

 

 

 

COMPILE_DOWNLOAD.png

Press F5 to download the program or click on the compile and download icon. If there are no compilation or download errors, you should see two eyes on the GLCD.

To add a mouth, we simply use DRAW_MOUTH.  DRAW_MOUTH takes 3 arguments. Xand Y being the position of the mouth and POS determines which mouth to draw.  Valid values of POS are 1, 2, 3, 4 or 5.  Please refer to the ‘IMAGES STORED IN THE SD CARD’ section for images of the mouth.  The code for drawing a mouth is as follow.

 

CODE:

 

 DRAW_MOUTH(32, 30, 1)

 

 

We have now drawn a complete face on the GLCD.  In the next section, we will do some animation with the face.

 BOB_FACE.png

 

CODE:

 

Public Sub Main()

       OS.GLCD.Init()

       OS.GLCD.Fill(255)

 

       'DRAW RIGHT EYE

       DRAW_EYE(25, 70, True)

       'DRAW LEFT EYE

       DRAW_EYE(75, 70, True)

 

       'DRAW MOUTH

       DRAW_MOUTH(32, 30, 1)

End Sub

 

 


download_sourceCode.png

Continue to Part TWO >>>