Announcement

Collapse
No announcement yet.

Writing unsigned int to the display

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

  • Writing unsigned int to the display

    Hello,

    I am trying to write an unsigned integer to a strings object. My code is not working, and I think I know why.

    genie.WriteObject(GENIE_OBJ_LED_STRINGS, 0, CountLife);

    I think that I need to convert CountLife, which is unsigned int, into a string first.
    Have been searching for aeges, and can't find a solution.
    Can anyone please help?

    Bob

  • #2
    Hello Bob

    Which version of the genieArduino library are you using?
    The latest version, released some 4 months ago, supports writing unsigned integers to string objects. You no longer need to format it to a string or character array.

    https://github.com/4dsystems/ViSi-Genie-Arduino-Library

    Hope that helps

    However, looking again at your function.... GENIE_OBJ_LED_STRINGS is not a an object we have...
    Did you mean GENIE_OBJ_STRINGS ?

    Regards
    James

    Comment


    • #3
      James,

      Thank you for your help.
      Yes that was an error with copy and pasting led digits, and changing to strings.
      I have downloaded, and installed the latest library. Still not working.


      Code:
      unsigned int CountLife = 20;
      genie.WriteObject(GENIE_OBJ_STRINGS, 0, CountLife);
      genie.WriteObject(GENIE_OBJ_LED_DIGITS, 0, CountLife);
      The led digits display the number, but not the strings, it just stays blank.

      Bob

      Comment


      • #4
        Hi Bob

        Please Zip Project (from file menu of WS4) and attach it here, just so I can make sure you have the right objects and index's set.
        I assume you are using the 'Strings' widget, and non Static Text or Label?
        I also assume its String0 you have on the screen that you are trying to write to?

        Regards
        James

        Comment


        • #5
          Hi James,

          I have done as you ask. Yes it is the strings widget, on form 2, I have 3 strings.
          Before I had several versions of arduino, and the genie library, which was confusing, so I have removed everything, and freshly installed arduino, and the lib, but no joy.


          Code:
          void loop()
          {
            genie.DoEvents(); // This calls the library each loop to process the queued responses from the display
            genie.WriteObject(GENIE_OBJ_STRINGS, 0, CountLife);
            CountLife ++;
          }
          That is the code I am using to test it with. I also have a bunch of event handlers for all of the buttons, they are working as they should. Looking at the release notes for the 10 Oct 15 library, it says support for unsigned int has been added for WriteStr command. Is this what I should be using instead?

          Bob
          Attached Files
          Last edited by Bob Edge; 22nd January 2016, 11:27 PM.

          Comment


          • #6
            Hi Bob

            yes sorry, you need to use:

            genie.WriteStr(0, CountLife);

            Please look at the demo which comes with the library dedicated to explaining this, WriteStr_Demo

            Regards
            James

            Comment


            • #7
              Thanks again James, working now.

              Bob

              Comment

              Working...
              X