ViSi-Genie: Arduino Form Request
Introduction
This codebase example presents a working example of how to use the "current form request" functionality in ViSi-Genie. The "current form request" functionality lets the host know which form is currently shown on the display module. This feature combines READ_OBJ and REPORT_OBJ messages, such that the host sends a READ_OBJ message for form objects and the display module replies with a REPORT_OBJ message containing the number or index of the active form. This code example contains a ViSi-Genie project and an Arduino sketch.
The application works in the following way:
- After bootup, the Arduino host sends a READ_OBJ message to the display module, inquiring about the number of the active form.
- The Arduino host sends an error message to the serial monitor if no reply is received within the predefined timeout period.
- If a reply is received, the host constantly writes to the LED digits objects on the display module.
- The host also constantly polls the display for the active form number. When a new form has been activated, its number is printed on the serial monitor.
Prerequisites
This codebase example assumes the reader can program the 4D Systems display module using Workshop4 IDE ViSi-Genie environment. Beginners are advised to read the following aplication notes.
- ViSi-Genie: Getting Started with PICASO Displays
- ViSi-Genie: Getting Started with DIABLO-16 Displays
- ViSi-Genie: Getting Started with PIXXI Displays
- ViSi-Genie: Connecting a 4D Display to an Arduino
Instructions
The following were the steps involved in creating this code example. 1. Create a ViSi-Genie project with three forms.
- Form0 - has a label and a winbutton for navigating to Form1.
- Form1 - has a label, a LED digits object, and a winbutton for navigating to Form2.
- Form2 - has a label, a LED digits object, and a winbutton for navigating to Form0.
The winbuttons are configured for form navigation through the object inspector.
-
Compile the project and upload the program to a uLCD-32PTU or any 4D Systems displays with PICASO, DIABLO-16, PIXXI-28 and PIXXI-44 graphics processors. Copy the supporting files to a uSD card mounted to the PC. Properly unmount the uSD card from the PC and mount it to the display.
-
Compile and upload the attached sketch to an Arduino Uno. The sketch uses a software serial port for the display and the hardware port Serial0 for logging messages to the serial monitor.
-
Properly connect the Arduino Uno to the uLCD-32PTU. See the application notes for this.
Besides using READ_OBJ and REPORT_OBJ messages, another way for the host to know which form is active on the display is to use REPORT_EVENT messages. For more information on using REPORT_EVENT messages, see ViSi-Genie: Arduino Form Navigation.