Announcement

Collapse
No announcement yet.

4D-CD-00016 ViSi-Genie Arduino itoa Demo for Strings

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 4D-CD-00016 ViSi-Genie Arduino itoa Demo for Strings



    The strings object in ViSi-Genie can display a predefined text or dynamic text or string. The application note

    ViSi-Genie Labels, Text, and Strings http://www.4dsystems.com.au/appnote/4D-AN-00013/

    discusses the difference between predefined and dynamic strings.

    Predefined strings are those that are created in Workshop during
    design time. These are actually saved into the uSD card and can later be
    retrieved during runtime. Dynamic strings, on the other hand, are those
    that are sent by a host to the display during runtime. A strings object (or
    container) can display a predefined string and a dynamic string, one at a
    time. There are separate commands for these.
    Refer to the application note specified above for more information.


    The application note

    ViSi-Genie Writing to Genie Objects Using an Arduino Host http://www.4dsystems.com.au/appnote/4D-AN-00018/

    shows how to write to a strings object to make it display predefined text or dynamic text.

    The application note further says:

    ...the second argument for genie.WriteStr() is a pointer to a null-terminated
    character array. Section 2.1.3.3 Write String (ASCII) Message of the
    ViSi-Genie Reference Manual emphasizes this.
    Certain applications may require the printing of integer values as a dynamic text on a string object on the display. There is therefore a need to covert the integer into a null-terminated character array. Hence, the itoa(...) function in C. Other applications may also require the insertion of dynamic integer values into text. To illustrate,
    "The display will turn off in n second(s)."
    Where n is a decrementing value. In this case, correct handling of character arrays is required.

    This code presents a working example of the above. Below are the steps involved in creating this code example.
    1. Create an Arduino sketch for a program that sends dynamic strings to the display.

    2. In Workshop 4 create a new ViSi-Genie project and add two strings objects.
    Strings0 - to be used for printing the changing value of a variable.
    Strings1 - to be used for printing the changing value of a variable inserted into a text.


    3. Compile the project and upload it to a uLCD-32PTU. Copy the supporting files to a uSD mounted to the PC. Properly unmount the uSD card from the PC and mount it to the uLCD-32PTU.

    4. Properly connect the Arduino Uno to the uLCD-32PTU. See the application notes for this.
    If without an Arduino host, you can still run this code example by performing steps 2 and 3. Then use the GTX tool to send a string to the display.

    Below is a video of the expected output. It is best to view the video using the highest setting for the quality (1080p).

    Attached Files
    Doff
Working...
X