Announcement

Collapse
No announcement yet.

Declaration problem in 4duino Diablo 16 Display

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

  • Declaration problem in 4duino Diablo 16 Display

    hi,

    please help me in these design problem

    1. In this design I want to change form with winbuttons . I am giving here my code. It is shown in code that " display was not declared in this scope". How should i declared display ? I am giving here my code.

    Code:
    #include<genieArduino.h>
    #include<SoftwareSerial.h>
    Genie genie;
    #define RESETLINE 4
    
    void setup()
    {
       Serial.begin(200000);
      genie.Begin(Serial);
      genie.AttachEventHandler(myGenieEventHandler);
    
      pinMode(RESETLINE , OUTPUT);
      digitalWrite(RESETLINE,1);
      delay(100);
      digitalWrite(RESETLINE,0);
      delay(3500);
    
      genie.WriteContrast(10);
    
    
    
    }
    
    void loop()
    {
      static long waitperiod = millis();
    
      genie.DoEvents();
      {
        if(millis()>=waitperiod)
        genie.ReadObject(GENIE_OBJ_WINBUTTON,0x00);
        genie.ReadObject(GENIE_OBJ_WINBUTTON,0x01);
        genie.ReadObject(GENIE_OBJ_WINBUTTON,0x02);
        genie.ReadObject(GENIE_OBJ_WINBUTTON,0x03);
    
        waitperiod=millis()+50;
      }
    
    
    }
    
    void myGenieEventHandler(void)
    {
      genieFrame Event;
      display.DequeueEvent(&Event);
    
       if(genie.EventIs(&Event,GENIE_REPORT_EVENT,GENIE_OBJ_WINBUTTON,0x00))
      {
       int button_val=display.GetEventData(&Event);
       if(button_val==1)
       WriteObject(GENIE_OBJ_FORM,1,0);
      }
      else if(genie.EventIs(&Event,GENIE_REPORT_EVENT,GENIE_OBJ_WINBUTTON,0x01))
      {
        int button_val=display.GetEventData(&Event);
       if(button_val==1)
       WriteObject(GENIE_OBJ_FORM,2,1);
      }
    
      else if(genie.EventIs(&Event,GENIE_REPORT_EVENT,GENIE_OBJ_WINBUTTON,0x02))
       {
        int button_val=display.GetEventData(&Event);
       if(button_val==1)
       WriteObject(GENIE_OBJ_FORM,3,2);
    
       }
        else if(genie.EventIs(&Event,GENIE_REPORT_EVENT,GENIE_OBJ_WINBUTTON,0x03))
       {
        int button_val=display.GetEventData(&Event);
       if(button_val==1)
       WriteObject(GENIE_OBJ_FORM,2,3);
    
       }
    }


    2. In Second Design I want to change form automatically after 5 second. here also it is shown " form was not declared in this scope". How should i declared form?
    here i attached my code...........

    Code:
    #include<genieArduino.h>
    #include<SoftwareSerial.h>
    Genie genie;
    #define RESETLINE 4
    //int form;
    
    unsigned long tnow;
    
    void setup()
    {
      Serial.begin(200000);
      genie.Begin(Serial);
    
      pinMode(RESETLINE , OUTPUT);
      digitalWrite(RESETLINE,1);
      delay(100);
      digitalWrite(RESETLINE,0);
      delay(3500);
    
      genie.WriteContrast(10);
    
      tnow=millis();
    
    
    }
    
    void loop()
    {
     genie.DoEvents();
     {
      if(millis()-tnow>5000)
      {
        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;
        }
        tnow=millis();
      }
     }
    }

    Thanking you,
    Hirak

  • #2
    Hi Hirak

    In the first code the line

    display.DequeueEvent(&Event);

    should be

    genie.DequeueEvent(&Event)


    In the second bit of code you can just un-comment //int form;

    Best regards

    Paul

    Comment


    • #3
      ok paul. It's quite helpful....

      one another problem is that when i used trackbar to vary the PWM voltage of arduino. It takes to much time to effect , that means when i change the position of trackbar , then out put voltage is changing after approx 7-10 sec. Its quite slow. can you please tell me the reason of it.

      I am using arduino UNO + u LCD-70DT + 4duino adaptor shield version 2

      I am attaching here an experiment video of it.

      https://drive.google.com/file/d/1frK...ew?usp=sharing



      Thanking you,
      Hirak

      Comment


      • #4
        Hi Hirak,

        I had a look at the video you sent. With everything I know so far, I'm still unable to come up with an idea to what could be causing this. Can you provide us with more information? I have a few questions below:
        1. Are you using SoftwareSerial?
          • If yes, try using a baudrate equal or lower to 19200. SoftwareSerial is not very reliable with higher baudrate
          • If not, please try to use this for Genie and temporarily use hardware serial for debugging. It would be good to know how frequent genie.DoEvents() is running (see next question)
        2. Are you running genie.DoEvents(); as frequent as possible? This function is responsible for handling and receiving messages from the display. This executes the attached event handler which you are using to set the PWM value.
        I'm hoping the items above will fix the issue.

        Best Regards,
        Juniel Cruz

        Comment


        • #5
          Hi Juniel,

          Actually i am using <software serial> in the code with baud rate 200000. and also use genie.DoEvents() frequently. Its check after every 50 ms.

          1. that means only I have to change the baud rate equal or lower to 19200 ?

          2. If I want to change the form in same design....then what I have to do? only a event handler code for change form OR a separate serial com also required?


          thanking you,
          Hirak



          Comment


          • #6
            Hi Hirak,

            Yes. Please try lowering the baudrate to 19200 or 9600.

            I think you also have another ticket asking about changing forms. Yes, you only need to handle the event. ViSi Genie only uses one Serial port.

            Please let us know if this improves things. If not, we can have a closer look if you send here both the ViSi Genie project and your Arduino sketch.

            If you plan to send the ViSi Genie project, please open your project and go to File -> Zip Project to save the project as zip.file.

            Regards,
            Juniel Cruz

            Comment

            Working...
            X