Skip to content

ViSi-Genie Magic: Arduino Three State Momentary Button

Introduction

To understand this codebase example more quickly, read and understand first 4D-CD-00017 ViSi-Genie Magic Three State Momentary Button. ViSi-Genie Magic Three State Momentary Button demonstrates the implementation of a custom three-state momentary button in ViSi-Genie. The custom three-state momentary button was created using a user button object with three frames. The behaviour of the user button in response to touch was then modified using magic objects. Every time that it was touched, the state of the custom button was sent to the serial port as a REPORT_OBJ message.

This codebase example presents a sketch for an Arduino program that will interact with the ViSi-Genie application in 4D-CD-00017 ViSi-Genie Magic Three State Momentary Button. The Arduino program receives and evaluates the messages from the ViSi-Genie program running on the display module. The states of the user button objects are then printed to the serial monitor of the Arduino IDE.

Note

Worskhop 4 PRO is needed for this codebase example.

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.

Instructions

  1. Compile the attached ViSi-Genie Magic project and upload the program to a uLCD-32PTU (or your target display). 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 uLCD-32PTU.

    Note

    1. The ViSi-Genie project in 4D-CD-00017 ViSi-Genie Magic Three State Momentary Button sends the state of the user button to the serial port using REPORT_OBJ messages. The ViSi-Genie project for this codebase example (ViSi-Genie Magic Arduino Three State Momentary Button) sends the state of the user button to the serial port using REPORT_EVENT messages.
    2. Workshop4 Pro is needed for this code example.
  2. Compile and upload the attached sketch to an Arduino Uno. The sketch uses a software serial port for the display.

  3. Properly connect the Arduino Uno to the uLCD-32PTU. See the application notes - ViSi-Genie: Connecting a 4D Display to an Arduino for this.

Attachment

Project File