Announcement

Collapse
No announcement yet.

Writing to Strings not working

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

  • Writing to Strings not working

    I am using an Arduino Mega to control a Gen4-uLCD-50DT-A Display.

    I have some int, float and string variables that I wish to print on the display. I tried all possible combinations that came to my mind but something doesn't seem to be working.

    I read somewhere that one has to store the possible strings in the dynamic string element when still in the design process. I don't wanna do this. I need the Arduino to print certain variables to the screen since the user can change these variables while the system is in use. How do I go about doing that?

    I am using Workshop 4 to create the display design. I tried both static text and strings under the "labels" tab.

    In the following cases I am trying to write the float variable "V_End" to the String element with index 1. Here are some code lines I tried using:

    genie.WriteStr(1, V_End): Here, I tried printing the variable directly
    genie.WriteStr(1, String(V_End)): Here, I tried casting the variable as a String before printing it
    genie.WriteStr(1, V_End): Here, I had changed the variable type to String and then tried printing it
    genie.WriteStr(1, "Test"): Here, I tried printing a string directly without a variable.

    All these did not work. I then tried the same combinations but with a static text element. For example:

    genie.WriteObject(GENIE_OBJ_STATIC_TEXT, 15, V_End): 15 is the element index and V_End is my float variable
    genie.WriteObject(GENIE_OBJ_STATIC_TEXT, 21, 5): here I tried printing an integer (5)
    genie.WriteObject(GENIE_OBJ_STATIC_TEXT, 22, "Test"): Here I tried to print a string directly

    I can't seem to be getting the hang of it and I'm thankful for suggestions!

    Rami




  • #2
    Hi,

    You can try the attached sample ViSi Genie project. For the Arduino sketch, you can go to Files -> Examples -> genieArduino and upload it. In this example, I use the Serial1 port of the display to communicate with Arduino.

    Also, I used the hardware serial of the Arduino. If you are using the 4D Arduino Adaptor Shield, there are jumper shorts that you can use to establish hardware connections.

    In the given sample project, you can follow the description of their pin connections below.

    RES -> AR
    RX -> D0
    TX -> D1
    PWR -> AR (Display is powered from Arduino) or PR(Display is powered from the Programmer)

    Regarding StaticText, as the name implies, it is static. Therefore, as you might realize, it is fixed and cannot be updated dynamically.

    Best Regards.
    Attached Files

    Comment


    • rami_94
      rami_94 commented
      Editing a comment
      Hi,

      thank you for your help.

      I tried your instructions and I only got a screen with "Hello" written on it. The text did not change.

      I am sure that my Arduino is able to communicate with the display. I have loads of other functionalities already programmed and they all work. the only thing that is not working so far is changing dynamic Strings.

      In my case the Display is powered by an external power source and I use Serial 2 to communicate with the display. The Jumpers are connected as follows:

      RES -> AR
      PWR -> PR
      RX -> RX2
      TX -> TX2

      Any ideas where the problem could be? Am I using an old Genie library or something similar? Any help is appreciated!

  • #3
    Hi,

    If you are using the gen4-IB to connect your display to the Arduino shield, you can simply change the COM port of the display to COM0. The serial pins of the gen4-IB are directly connected to the Serial0 of the display.

    Best regards

    Comment


    • ivan_4d
      ivan_4d commented
      Editing a comment
      Hi rami,

      As Juniel explained, I was referring to COM0 of the display.

      Try to use the COM0 of the display to interface with the host and, let us know if it works.

      We will wait for your update.

      Best Regards

    • rami_94
      rami_94 commented
      Editing a comment
      Sorry for the late reply but I was on holiday!

      in Workshop 4 --> Project --> Coms: Com0 has always been selected. I never changed it in the first place.

      It still doesn't work. Any further suggestions? I am thinking of buying a new screen and testing it there. It's so weird that everything works except for writing dynamic strings to the screen!

    • rami_94
      rami_94 commented
      Editing a comment
      Do you think the programming adapter could be the problem? May be a pin is faulty or something?

  • #4
    I'm more than happy to call you if you provide me with a contact number

    Comment


    • #5
      Hi,

      To help you better, can you share your project with us?

      To share your project completely, you can follow this article for the instruction: How can I share my projects?

      Best Regards

      Comment


      • rami_94
        rami_94 commented
        Editing a comment
        Hi Ivan,

        I'm sorry to inform you that I am unable to do so due to data protection reasons of my workplace.

        It's a repeated question but I wanna make sure I understand this correctly: Can I write any string to my string object? Or I only can choose from a set of already saved strings in my dynamic string object based on the chosen index?

      • Juniel Cruz
        Juniel Cruz commented
        Editing a comment
        Hi Rami,

        To make it clear, we are talking about the Strings widget. Not the StaticText or any other text based widget.

        The answer would be, yes, you can write dynamic strings to a Strings widget.

        I would suggest you to try this.
        - Create a fresh ViSi Genie project
        - Add a Strings widget
        - Upload to your display
        - Open GTX and write some strings

        This will show you clearly it can be done.

      • rami_94
        rami_94 commented
        Editing a comment
        Hi Juniel,

        thanks for your reply.

        Yes exactly. I am also talking about the "Strings" object under the "Labels" tab.

        I will try to do that as soon as possible and give you some feedback. This might take a while though since I am busy with some other project at the moment.

        Regards,
        Rami
    Working...
    X