Announcement

Collapse
No announcement yet.

4Duino as normal 2.4 screen

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 4Duino as normal 2.4 screen

    Hi,

    Would it be possible to use the 4Duino as an Uno communicating with a normal 2.4PTU screen and design the GUI with Visi-Genie and using the genieArduino library?

    I have used other 4D displays in projects and it just seems easier to use Visi-Genie to do the GUI design than the 4Duino Extended graphics environment.

    I saw that the Picasso, on the 4Duino, is connected to the hardware serial port, pins 0 and 1 and assume the initialization should look like this:
    .
    .
    Genie genie;
    .
    .
    void setup()
    {
    Serial.begin(9600);
    genie.Begin(Serial);
    genie.AttachEventHandler(myGenieEventHandler);
    .
    .
    .
    }

    What I can't find is the pin number of the reset pin in order to reset the display on startup?

    Regards
    Jan

  • #2
    Good day JanSpiesZA,

    The 4Duino uses ATmega32U4 which is a Arduino Leonardo to be exact.
    We have not conducted extensive test on this particular way of programming the 4Duino. We do not recommend to program the 4Duino this way as you may encounter a lot of problems and this may void your warranty on the display module.

    In one standpoint, your idea would be possible. You can see that the included libraries on the Extended Graphics environment indicates "Serial Library" because the Picaso processor runs as a serial environment program (SPE application on the serial environment) and works as a slave to the ATmega32U4. The Extended Graphic environment then uses serial commands (from the serial environment library) to control images on the display module.

    If you wish to push through, The PICASO reset pin is indicated in the datasheet indicated as PICASO RESET, it is connected to the ATmega32U4 on pin PD5(XCK1/CTS)


    Comment


    • #3
      Thanks, Mark,

      I think I might not be expressing myself correctly or I am missing something crucial: I would like to use Genie Graphics on the 4Duino.

      Section 11.5 in this datasheet, talks about the Genie Graphics (https://www.mouser.com/ds/2/451/4Dui...1_2-968583.pdf) as a development option. I am aware that this feature is not yet implemented for the 4Duino in SW4 yet, however, this post (http://forum.4dsystems.com.au/forum/...889-visi-genie) mentions that you can do the Genie Graphics as if it is a normal -AR kit.

      Obviously, I am missing something but cannot figure out what it is.

      Thanks
      Jan

      Comment


      • #4
        The datasheet indicates and discusses the 4Duino Genie Graphics which is different from the ViSi-Genie Programming Environment.

        If you wish to perform use the ViSi Genie Programming environment on your 4Duino, you may perform the following steps:

        1.) Connect the 4Duino to the PC via a uUSB-PA5-II or 4D Programming Cable through the PICASO program header pins.
        2.) Open WS4 IDE and create a ViSi-Genie project using a uLCD-24PTU
        3.) Design the GUI, Save and load it to the display module and microSD card. For this test, I only placed a Slider widget and a Coolgauge. Configure the Slider to Report Event.
        4.) Go to File > Options > Arduino > and File > Options > Genie
        Perform the following changes based on the photos.
        Click image for larger version  Name:	2018-02-09_13-37-12.jpg Views:	1 Size:	74.4 KB ID:	61863

        Click image for larger version  Name:	2018-02-09_13-37-32.jpg Views:	1 Size:	62.9 KB ID:	61864


        4.) Load the program to the display module. Remove the uUSB-PA5-II, connect the 4Duino to the PC via a microUSB cable.
        5.) Open Arduino and on the Tools tab, select the 4Duino as the board (assuming youve properly installed the 4Duino dependencies)
        6.) Open the genieArduino_Demo program, copy and paste it to another empty sketch. Change the following details of the program:

        Baudrate to your project's baudrate (usually 9600)
        Change the RESETLINE to pin 30
        Change the Serial.begin to Serial1.begin
        Comment out or remove anything pertaining to writing widgets that are not on the GUI.

        Or simply just add this code derived from the genieArduino:

        #include <genieArduino.h>

        Genie genie;
        #define RESETLINE 30 // Change this if you are not using an Arduino Adaptor Shield Version 2 (see code below)
        void setup()
        {
        // NOTE, the genieBegin function (e.g. genieBegin(GENIE_SERIAL_0, 115200)) no longer exists. Use a Serial Begin and serial port of your choice in
        // your code and use the genie.Begin function to send it to the Genie library (see this example below)
        // 200K Baud is good for most Arduinos. Galileo should use 115200.
        Serial1.begin(9600); // Serial0 @ 200000 (200K) Baud
        genie.Begin(Serial1); // Use Serial0 for talking to the Genie Library, and to the 4D Systems display

        genie.AttachEventHandler(myGenieEventHandler); // Attach the user function Event Handler for processing events

        // Reset the Display (change D4 to D2 if you have original 4D Arduino Adaptor)
        // THIS IS IMPORTANT AND CAN PREVENT OUT OF SYNC ISSUES, SLOW SPEED RESPONSE ETC
        // If NOT using a 4D Arduino Adaptor, digitalWrites must be reversed as Display Reset is Active Low, and
        // the 4D Arduino Adaptors invert this signal so must be Active High.
        pinMode(RESETLINE, OUTPUT); // Set D4 on Arduino to Output (4D Arduino Adaptor V2 - Display Reset)
        digitalWrite(RESETLINE, 1); // Reset the Display via D4
        delay(100);
        digitalWrite(RESETLINE, 0); // unReset the Display via D4

        delay (3500); //let the display start up after the reset (This is important)

        // Set the brightness/Contrast of the Display - (Not needed but illustrates how)
        // Most Displays, 1 = Display ON, 0 = Display OFF. See below for exceptions and for DIABLO16 displays.
        // For uLCD-43, uLCD-220RD, uLCD-70DT, and uLCD-35DT, use 0-15 for Brightness Control, where 0 = Display OFF, though to 15 = Max Brightness ON.
        genie.WriteContrast(1);

        }

        void loop()
        {

        static long waitPeriod = millis();
        static int gaugeAddVal = 1; // Simulation code variable. Value to change the gauge by each loop
        static int gaugeVal = 50; // Simulation code variable. Value to start the gauge at when powered on

        genie.DoEvents(); // This calls the library each loop to process the queued responses from the display

        }


        void myGenieEventHandler(void)
        {
        genieFrame Event;
        genie.DequeueEvent(&Event); // Remove the next queued event from the buffer, and process it below

        int slider_val = 0;

        //If the cmd received is from a Reported Event (Events triggered from the Events tab of Workshop4 objects)
        if (Event.reportObject.cmd == GENIE_REPORT_EVENT)
        {
        if (Event.reportObject.object == GENIE_OBJ_SLIDER) // If the Reported Message was from a Slider
        {
        if (Event.reportObject.index == 0) // If Slider0 (Index = 0)
        {
        slider_val = genie.GetEventData(&Event); // Receive the event data from the Slider0
        genie.WriteObject(GENIE_OBJ_COOL_GAUGE, 0, slider_val); // Write Slider0 value to to LED Digits 0
        }
        }
        }

        }


        I seldom offer this procedure because I've experienced a user brick his 4Duino (I dont know what he specifically did)leaving a white screen undetected 4Duino in comms. But as long as you follow the procedure it will work out fine.

        Also, I just copied the genieArduino_Demo and forgot about a LED digit is also used in the code so I just removed that part of the demo code.

        Comment


        • #5
          Hi Mark,

          Thankx for the extremely detailed How-To!! It works like a charm!!!

          On the first try, the SmartGuage did not update when the slider changed, however, after re-programming the Arduino it worked...

          Once again THANK YOU!!!

          Regards
          Jan

          Comment

          Working...
          X