Announcement

Collapse
No announcement yet.

4d display design

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

  • 4d display design

    hi,
    I faced some problem for designing 4d project.

    In my design there are four form FORM 0, FORM 1, FORM 2, FORM 3

    I want to change form 0 to form 1 after 30 sec automatically every time when the system start. After that i want to change form with winbutton.

    when i run that program FORM 0 to FORM 1 change with in 1 sec and winbuttons are not working.

    this is my code

    Code:
    #include<genieArduino.h>
    #include<SoftwareSerial.h>
    Genie genie;
    #define RESETLINE 4
    static long tnow=millis();
    int form;
    
    void setup()
    {
      Serial.begin(200000);
      genie.Begin(Serial);
    
      pinMode(RESETLINE , OUTPUT);
      digitalWrite(RESETLINE,1);
      delay(100);
      digitalWrite(RESETLINE,0);
      delay(3500);
    
      genie.WriteContrast(10);
    
    
    
    }
    
    void loop()
    {
     genie.DoEvents();
      {
    
        if(millis()-tnow>30000)
        {
          if(form==0)
          genie.WriteObject(GENIE_OBJ_FORM,1,0);
          form=1;
        }
        else if(form==1)
        {
          genie.WriteObject(GENIE_OBJ_FORM,0,0);
          form=0;
        }
    
        genie.ReadObject(GENIE_OBJ_WINBUTTON,0x11);
        genie.ReadObject(GENIE_OBJ_WINBUTTON,0x18);
        genie.ReadObject(GENIE_OBJ_WINBUTTON,0x21);
        genie.ReadObject(GENIE_OBJ_WINBUTTON,0x25);
        tnow=millis()+50;
    
      }
    
      }
    
    void myGenieEventHandler(void)
    {
      genieFrame Event;
     genie.DequeueEvent(&Event);
    
      if(genie.EventIs(&Event,GENIE_REPORT_EVENT,GENIE_OBJ_WINBUTTON,0x11))
     {
       genie.WriteObject(GENIE_OBJ_FORM,2,1);
     }
    
      else if(genie.EventIs(&Event,GENIE_REPORT_EVENT,GENIE_OBJ_WINBUTTON,0x18))
     {
       genie.WriteObject(GENIE_OBJ_FORM,2,1);
     }
    
      if(genie.EventIs(&Event,GENIE_REPORT_EVENT,GENIE_OBJ_WINBUTTON,0x21))
     {
       genie.WriteObject(GENIE_OBJ_FORM,3,2);
     }
    
      if(genie.EventIs(&Event,GENIE_REPORT_EVENT,GENIE_OBJ_WINBUTTON,0x25))
     {
       genie.WriteObject(GENIE_OBJ_FORM,2,3);
     }
    
      }

    Thanking you,
    Hirak
    Last edited by Hirak Dash; 4 weeks ago.

  • #2
    Good day,

    Instead of making the host poll the button states, in which case it might miss a button press when this is currently polling, why not just link the buttons itself in ViSi-genie to activate the needed form. You can do this by setting the Onchanged handle of the button to Form_Activate in the object inspector; if you also need to know the forms changed, you can also put a Report Message event on the target form itself.

    Best Regards,

    Comment


    • #3
      Hi,


      I used 20 number of winbutton on design. how i number winbutton after 9.

      genie.ReadObject(GENIE_OBJ_WINBUTTON, 0x10 ) OR genie.ReadObject(GENIE_OBJ_WINBUTTON, 0x0A)

      genie.ReadObject(GENIE_OBJ_WINBUTTON, 0x15 ) OR genie.ReadObject(GENIE_OBJ_WINBUTTON, 0x0F)




      Thanking you,
      Hirak

      Comment


      • #4
        Hi Hirak

        You can use a decimal number here if you wish, it's not necessary to use hexadecimal

        so

        genie.ReadObject(GENIE_OBJ_WINBUTTON, 9);
        genie.ReadObject(GENIE_OBJ_WINBUTTON, 10);
        genie.ReadObject(GENIE_OBJ_WINBUTTON, 11);
        genie.ReadObject(GENIE_OBJ_WINBUTTON, 12);

        Is totally acceptable

        Best regards

        Paul

        Comment


        • #5
          hi paul,

          it's not working. upto 0-9 it working , but when i use 0x10, 0x11 , 0x12 it is not working.


          thanking you,
          Hirak

          Comment


          • #6
            Hi Hirak,

            0-9 in decimal and hexadecimal is the same, but 0x10 in hex is 16 in decimal. 0x11 is 17, and 0x12 is 18.
            Its best to use decimal for everything.
            If you are trying to access objects 10, 11 and 12 from Workshop, then use 10, 11 and 12, not 0x10, 0x11 and 0x12 as those hex values are not the same.

            So if I look at your code above in post #3, you have this:

            Code:
            genie.ReadObject(GENIE_OBJ_WINBUTTON, 0x10 ) OR genie.ReadObject(GENIE_OBJ_WINBUTTON, 0x0A)
            
            genie.ReadObject(GENIE_OBJ_WINBUTTON, 0x15 ) OR genie.ReadObject(GENIE_OBJ_WINBUTTON, 0x0F)

            What you are actually writing is the same as this, which I suspect is NOT correct:

            Code:
            genie.ReadObject(GENIE_OBJ_WINBUTTON, 16 ) OR genie.ReadObject(GENIE_OBJ_WINBUTTON, 10)
            
            genie.ReadObject(GENIE_OBJ_WINBUTTON, 21 ) OR genie.ReadObject(GENIE_OBJ_WINBUTTON, 15)
            Does this help you at all?

            Regards
            James

            Comment

            Working...
            X