Announcement

Collapse
No announcement yet.

Configuration

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

  • Configuration

    Hello everybody

    I am using the GEN4 -ULCD-70DT-AR display. I will be using it to display various sensor values such as temperature, wind speed, rain density and humidity. I have recently begun designing the interface in the designer but have come across a problem. For some reason, when i link items, for example, track-bar to meter just to test the outputs, it does not work.

    I am only in the beginning stages and only want to test the outputs using virtual inputs. For example, Track bar on changing event set to meter0set and on changed of meter0 set to digitalled1

    Please could you help

    Thank you

  • #2
    Hi,

    Welcome to the forum!
    Can I ask what environment are you using on designing your application(e.g. ViSi, ViSi-Genie)?

    For some reason, when i link items, for example, track-bar to meter just to test the outputs, it does not work.
    Have you loaded the program on the display? Can I also ask how did you test this?

    Have you tried this application note?
    AN-00002 ViSi-Genie onChanging and onChanged Events
    https://4dsystems.com.au/blog/4d-an-00002/

    Please let me know.

    Best Regards,
    Kevin

    Comment


    • ChaddAnthony
      ChaddAnthony commented
      Editing a comment
      Hi, I am using ViSi Genie. I have designed my GUI using the GEN4 -UCLD- 70DT. I am aware that it should still work for this version. However, I have got everything to work besides writing my sensor data to the display. I am using the Arduino MEGA 2560 REV3 board as a host. i Have imported the latest BETA genie.Arduino library and i am using the following method to write to the display

      my baud rate is 9600 within software as well as in the designer/Comms section. I have no idea why nothing is being writen to the display. I have checked my TX and RX connections as well.

      PLEASE HELP.

      here is my code:

      #include <genieArduino.h>
      #include <dht.h>

      #define ANEMOMETER_PIN A0 //Anemometer Input
      #define DHT11_PIN 7 //Temp and Humidity sensor input pin

      #define RESETLINE 4 // Change this if you are not using an Arduino Adaptor Shield Version 2 (see code below)

      const long sampletime1 = 500;
      const long sampletime2 = 1500;
      dht DHT;
      Genie genie;

      unsigned long PreviousSampleTime1 = 0;
      unsigned long PreviousSampleTime2 = 0;

      void setup()
      {

      Serial.begin(9600); //Initialize serial console
      genie.Begin(Serial); // Use Serial0 for talking to the Genie Library, and to the 4D Systems display
      pinMode(5, OUTPUT); //Initialize pin 2 as output
      //genie.AttachEventHandler(myGenieEventHandler); // Attach the user function Event Handler for processing events

      pinMode(RESETLINE, OUTPUT); // Set D4 on Arduino to Output (4D Arduino Adaptor V2 - Display Reset)
      digitalWrite(RESETLINE, 1); // Reset the Display via D4
      delay(100);
      digitalWrite(RESETLINE, 0); // unReset the Display via D4
      delay (3000); //let the display start up after the reset (This is important)

      genie.WriteContrast(7);



      }

      void loop()
      {
      int raw_value = analogRead(ANEMOMETER_PIN); //Read raw value from anemomoter
      float wind_value = raw_value * (5.0 / 1023.0 ) * ((35*3.6)/(950*0.02)); //Convert raw value to voltage, convert voltage to windreading
      int wind_kMh = wind_value*3.6;
      //genie.DoEvents();
      unsigned long currentTime = millis();



      if(currentTime - PreviousSampleTime1 >= sampletime1 ){


      Serial.print("Wind speed = ");
      Serial.println(wind_kMh);
      PreviousSampleTime1 = currentTime;
      genie.WriteObject(GENIE_OBJ_METER, 0x00, wind_kMh);


      }
      if(currentTime - PreviousSampleTime2 >= sampletime2 ){

      int chk = DHT.read11(DHT11_PIN);
      Serial.print("Temperature = ");
      Serial.println(DHT.temperature);
      Serial.print("Humidity = ");
      Serial.println(DHT.humidity);
      genie.WriteObject(GENIE_OBJ_LED_DIGITS,0x01, DHT.temperature);
      genie.WriteObject(GENIE_OBJ_LED_DIGITS,0x02, DHT.humidity);


      /* Update the timing for the next reading */
      PreviousSampleTime2 = currentTime;
      }


      if(wind_kMh >= 38){
      digitalWrite(5,HIGH);
      }
      else{
      digitalWrite(5,LOW);

      }

      }

  • #3
    Hi

    looking at your code above, Serial.print is being used on the same serial port as the display. This means that the display is receiving the same datat that you are printing to the serial port which will cause genie to stop functioning. Initially, I would advise commenting out the Serial.print commands. A better way to do this would be to use Serial1 on the Mega to talk to the display, this way you can still have the Serial.print commands working as the display would be on a different serial port.

    Best regards

    Paul

    Comment


    • ChaddAnthony
      ChaddAnthony commented
      Editing a comment
      Hi Pauleilio, So i would say

      Serial1.begin(9600); //Initialize serial 1 console
      genie.Begin(Serial1);

      or is there additional code?

  • #4
    Hi,

    Yes thats correct, and you would have to make the hardware changes also to connect the display to the Megas Serial port 1

    Comment


    • ChaddAnthony
      ChaddAnthony commented
      Editing a comment
      My adapter shield's J3 (RX) is connected to RX1 on the MEGA and J4 (TX) to TX1 on the MEGA

  • #5
    Hi

    Yes, thats correct

    Comment


    • ChaddAnthony
      ChaddAnthony commented
      Editing a comment
      Okay i will attempt it again. I am using Gen4-UCLD-70DT -AR display. When i select this option, there are only 2 environments available, Basic and extended graphics. Is there an alternative display option i can select in order to utilize my display?

  • #6
    Hi,

    Ahh, ok. Yes you need to be using Visi-Genie to use with the Arduino genie code you created.

    Could you try selecting Gen4-UCLD-70DT from the Diablo Gen4 range and then select Visi-genie

    Best regards

    Paul

    Comment


    • ChaddAnthony
      ChaddAnthony commented
      Editing a comment
      I will do that. Thank you very much for all your help. I will get back to you should i encounter any additional issues.

      Kind regards

      Chadd

  • #7
    Hi, I changed the display, and then when i tried to use the graphics tester (GTX) it would say COM PORT INVALID even though prior to this change the COM port was working perfectly fine. Why is this?

    Comment


    • #8
      Hi Chadd,

      Not sure why that has happened. The display should still be working on COM0 can you click on File then Options and then the Genie tab to see what the settings for Genie are

      Best regards

      Paul

      Comment


      • ChaddAnthony
        ChaddAnthony commented
        Editing a comment
        Hi Paul,
        I have managed to fix it. Thank you.

        I would like to know is the following setup correct?

        Serial1.begin(9600);
        genie.Begin(Serial1);

        in WS4, under the genie tab, i have com 0 selected (instead of 1) at 9600 baud rate

        hardware connections:
        J3 (RX) is connected to RX1(D19) on the MEGA and J4 (TX) to TX1(D18) on the MEGA
    Working...
    X