Announcement

Collapse
No announcement yet.

Question about visi-gene and arduino design

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Question about visi-gene and arduino design

    Hi,
    I am the new in 4d display. please help me to solve the following problem


    1. I want to change form0 to form1 using a timer . timer time 30sec. how i will program that.

    2. I want to change form1 to form2 using a numeric keyboard, how i program that and set password.


    I am using GEN4-uLCD-70DT + Arduino mega 2560


  • #2
    Hi,

    Welcome to the forum

    You could try adding this code to change form after 30 seconds

    Code:
    unsigned long tnow;
    
    void setup(){
      tnow = millis();
    }
    
    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;
        }
      tnow = millis();
      }
    }
    You may find this appnote and example for password entry on the Arduino

    https://docs.4dsystems.com.au/app-note/4D-AN-00188?

    I hope this helps

    Best regards

    Paul

    Comment


    • #3
      hi Paul,

      thank you very much for the help,

      I am a hardware design engineer, comfortable in c programming. I want to control my electronic PCB with Arduino host accordingly with 4D display module.

      1. is there all syntax,operator written in any note . in which it help me to design any kind of control unit for any kind of design using 4D display.

      2. is knowing c programming is sufficient to programming in visi-genie with Arduino host.


      Thanking you,

      Hirak Dash

      Comment


      • #4
        Hi Hirak,

        You will find the Visi-Genie reference manual helpful

        https://4dsystems.com.au/mwdownloads...ad/link/id/27/

        Our appnotes section has many examples for Visi-Genie and Arduino

        https://docs.4dsystems.com.au/app-notes

        We also have a Visi-Genie Library for Arduino that comes with examples that you use as a starting template for your project.

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

        Having a sound knowledge of C programming will certainly help. There is no need to know how to program the display with Visi-Genie so you only need coding experience with your chosen Arduino.

        Best regards

        Paul

        Comment


        • #5
          ok. thank you.

          Comment


          • #6
            hi,

            I am GEN4-uLCD-70DT + Arduino mega 2560


            1. I want to change FORM 0 to FORM 1 , when winbutton is ON. Please tell me how would I read winbutton status to change the form 0 to 1.

            2. How i change 0V to 5V of a digital pin of arduino using a trackbar on display.

            3. can i generate 100ns to 100 us pulse in arduino in which the range can be select by visi-genie display and one copy is display in display module oscilloscope.


            Thanking you,

            Hirak Dash.

            Comment


            • #7
              Hello Hirak,

              To change form on a button press from the Arduino you would use the event handler in the Visi Genie library, something like this.

              Code:
              void myGenieEventHandler(void)
              {
                genieFrame Event;
                display.DequeueEvent(&Event); // Remove the next queued event from the buffer, and process it below
              
                 //If the cmd received is from a Reported Event (Events triggered from the Events tab of Workshop4 objects)
                 if (Event.reportObject.cmd == GENIE_REPORT_EVENT)
                 {
                   if (Event.reportObject.object == GENIE_OBJ_WINBUTTON) // If the Reported Message was from a winbutton
                   {
                     if (Event.reportObject.index == 0) // If Winbutton0 (Index = 0)
                     {
                       int button_val = display.GetEventData(&Event); // Receive the event data from the Winbutton0
                       if(button_val == 1) WriteObject(GENIE_OBJ_FORM, 1, 0); //for form 1
                     }
                   }
                 }  
              }
              These are the commands to change a form

              Code:
              WriteObject(GENIE_OBJ_FORM, 0, 0); //for form 0
              WriteObject(GENIE_OBJ_FORM, 1, 0); //for form 1
              This application note will help in understanding how to use a slider or trackbar and send the data to the Arduino to cotrol an output which would be a LED in this example.

              https://docs.4dsystems.com.au/app-note/4D-AN-00010

              Sending a value from a slider to the Arduino for the Arduino to use in the manner you want is possible but I'm not sure if the scope is the best way to present this information on the display but if you prefer to use the scope you may find this appnote useful

              https://docs.4dsystems.com.au/app-note/4D-AN-00028/

              I hope this helps

              Best regards

              Paul

              Comment


              • #8
                Thank you paul , these information will be helpfull to me.

                1. Some another doubt i have to clear, I am using Arduino 1.8.13 . and write the bellow code for control RBG control using three slider. here it is shown 'event' was not declared in this scope. is there any problem in this code.

                2. here in object index 0x00 , 00 means the object index. what does the first 0 means.

                3 What is the work of genieFrame Event


                Code:
                #include<genieArduino.h>
                Genie genie;
                #define RESETLINE 4
                
                int RED=9;
                int GREEN=10;
                int BLUE=11;
                
                void setup()
                {
                  Serial.begin(200000);
                  genie.Begin(Serial);
                  genie.AttachEventHandler(myGenieEventHandler);
                
                  pinMode(RESETLINE , OUTPUT);
                  digitalWrite(RESETLINE,1);
                  delay(100);
                  digitalWrite(RESETLINE,0);
                  delay(4500);
                
                  genie.WriteContrast(10);
                
                 genie.WriteStr(0,"Designed by Hirak Dash");
                
                
                }
                
                void loop()
                {
                  static long waitperiod = millis();
                
                  genie.DoEvents();
                  {
                    if(millis()>=waitperiod)
                    genie.ReadObject(GENIE_OBJ_WINBUTTON,0x00);
                    genie.ReadObject(GENIE_OBJ_SLIDER , 0x00);
                    genie.ReadObject(GENIE_OBJ_SLIDER, 0x01);
                    genie.ReadObject(GENIE_OBJ_SLIDER, 0x02);
                
                    waitperiod=millis()+50;
                  }
                
                
                }
                
                void myGenieEventHandler(void)
                {
                  genieFrame Event;
                  genie.DequeueEvent(&Event);
                
                  int slider_value=0;
                
                  if(genie.EventIs(&Event,GENIE_REPORT_EVENT,GENIE_OBJ_WINBUTTON,0x00))
                  {
                    genie.WriteObject(GENIE_OBJ_SLIDER,0x00,128);
                    genie.WriteObject(GENIE_OBJ_SLIDER,0x01,128);
                    genie.WriteObject(GENIE_OBJ_SLIDER,0x02,128);
                    analogWrite(RED,128);
                    analogWrite(GREEN,128);
                    analogWrite(BLUE,128);
                  }
                  else
                   {
                    slider_value=genie.GetEventData(&Event);
                
                    if (event.reportObject.index==0x00)
                    analogWrite(RED,slider_value);
                
                    else if(event.reportObject.index==0x01)
                    analogWrite(GREEN,slider_value);
                
                    else if(event.reportObject.index==0x02)
                    analogWrite(BLUE,slider_value);
                   }
                
                }

                Comment


                • #9
                  Hi Hirak

                  That to me looks like a typo. Could you please try changing all 'event' to 'Event'

                  Best regards

                  Paul

                  Comment


                  • #10
                    Thanks paul, Its working.

                    Comment

                    Working...
                    X