Announcement

Collapse
No announcement yet.

Can I get a variable from my VisiGenie app to my Arduino?

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

  • Can I get a variable from my VisiGenie app to my Arduino?

    Hello,

    I want to pass a variable from my 4D Diablo16 monitor using VisiGenie back to my arduino. Is it possible to do this? It could either be a hard coded value, or it could be a Strings box. I just need a way to pass a version number from the monitor app back to the arduino.

    Thanks!

  • #2
    Good day!

    Yes, it is possible. This will require you Workshop4 PRO. This can easily be implemented by using a MagicObject such as below:

    Code:
    #CONST
        // Major Rev is 0 to 255
        // Minor Rev is 0 to 255
    
        // Version 1.0
        VERSION_MAJOR 1
        VERSION_MINOR 0
    
        // Version 1.2
        //VERSION_MAJOR 1
        //VERSION_MINOR 2
    
        // Version 1.11
        //VERSION_MAJOR 1
        //VERSION_MINOR 11
    
        // Version 2.101
        //VERSION_MAJOR 2
        //VERSION_MINOR 101
    #END
    
    func rMagicObject0(var action, var object, var newVal, var *ptr)
    
        if (action == READ_OBJ)
    
        // Send Major Revison
            SendReport(REPORT_OBJ, tMagicObject, 0, (VERSION_MAJOR << 8) | (VERSION_MINOR));
    
        endif
    
    endfunc
    Then simply send a read object command to the MagicObject (34) index 0.

    You will then receive a GENIE_REPORT_OBJ that contains the revision.

    As you can see the revision is simply the high byte and low byte of the data/value sent.

    I hope this helps.

    Best Regards
    Juniel Cruz

    Comment


    • #3
      Hi Juniel,

      Do you have an example from the arduino side on how to read it? I am not having much luck getting the value back. I am trying genie.ReadObject(35, 0), but it just returns a 1.

      Comment


      • #4
        Good day!

        Originally posted by BrandonRohde View Post
        I am trying genie.ReadObject(35, 0), but it just returns a 1.
        You seem to be reading the wrong object type (35).

        As mentioned in my previous reply:
        ​​​
        Originally posted by Juniel Cruz View Post
        simply send a read object command to the MagicObject (34) index 0.
        You will then receive a GENIE_REPORT_OBJ from MagicObject (34) index 0.

        Best Regards
        Juniel Cruz

        Comment

        Working...
        X