Announcement

Collapse
No announcement yet.

Confused about WriteObject

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

  • Confused about WriteObject

    I have a slider running from 0 to 100.
    I have a Thermometer running from 50 to 80 (The screen shot shows 100 but it should say 80).
    I have Leddigits.



    I am using a Magic Event to read the slider and map the slider value to the temperature range (50 to 80) and then write it to the Digits which then sends the value to the Thermometer.

    func MagicEvent0()
    var valS ;
    valS := img_GetWord(hndl, iSlider0, IMAGE_INDEX) ;
    valS := ((valS/100) *30)+50;
    WriteObject(iLeddigits4, 0, valS) ;
    endfunc

    It all works (no compiler errors) but the Digits display zreos.
    I know the the slider value reads OK and I know my math works OK.
    So the issue is with the WriteObject.

    I don't find a document that fully explains the WriteObject syntax.

    Is the Object Type "Leddigits" or the name of the object "Leddigits4"?

    Where does the ObjectIdx come from?

    Why do I need to put a "t" or an "i" in front of the Object type?

    Or do I need to do something to refresh the Leddigits after a WriteObject?

    Thanks in advance for your help with this issue.

    Last edited by Felich; 28th March 2018, 11:08 AM.

  • #2
    Hello Felich,

    Press the F1 button while on the Workshop4 and the ViSi-genie reference manual pdf will appear. It is shown on page 6 where you can find the syntax for the write object command. In page 39, you can find the Object summary table. The "i" or "t" prefix is for the Arduino ViSi-genie library constants name.

    The object ID should be iObject and the object index is the suffix index of the object being referred to, in your case: object ID = iLeddigits object index = 4.

    After writing the value to an object there is no need to refresh the object as it will stay at the last updated value.

    I hope this helps,

    Comment


    • #3
      Jerson,

      Well, it helped get the Magic Event working, but the object ID needed to be tLeddigits not iLeddigits.
      I found that information on page 44 of the ViSi-genie reference manual.

      I still do not understand why the img_GetWord index must be iSlider0.
      The Diablo16 Internal Functions Manual has the syntax img_GetWord(handle, index, offset);​​​​.

      So how should I know to use iSlider0 as the index?

      Where is that information located?

      It is difficult to write Magic Events without full knowledge of object and index naming conventions.
      I don't like to waste my time guessing at names and using trial and error testing.

      Thank you for your help,
      Jim

      Comment


      • #4
        Hello Felich,

        I kinda overlooked the part that you are using genie magic events; iObject is for Arduino constants while tObject is used for genie magic constants. The Genie Magic Callable Functions are the functions that you might be referring to, you can check all the functions and their parameters on page 42 of the ViSi-genie reference manual.

        I hope this helps

        Comment

        Working...
        X