Announcement

Collapse
No announcement yet.

uLCD32PDT more than 2 trackbars, data not sending

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

  • uLCD32PDT more than 2 trackbars, data not sending

    I have written a test program for Arduino to serial.print inputed trackbar changes from my Screen.

    It works perfectly reading from trackbar0 and trackbar1, but as soon as I try using more trackbars, the Arduino acknowledge the object sent data but no data is returned.

    my script tells me for example trackbar2 did activate but not data was received.
    while trackbar0 and 1 function correctly.
    Is there a limit on how many trackbars can be used on one form?
    I have tried writing the program to ram, flash and uSD





  • #2
    Hello Thebaconson

    Welcome to the forum

    Best way would be to attach your code so we can see first hand what your code is doing, and provide some feedback.

    Regards
    James

    Comment


    • #3
      Code:
      #include <genieArduino.h>
      
      Genie genie;
      #define RESETLINE 4
      void setup()
      {
        Serial.begin(9600);
        genie.Begin(Serial);
      
        genie.AttachEventHandler(myGenieEventHandler);
      
        pinMode(RESETLINE, OUTPUT);
        digitalWrite(RESETLINE, 1);
        delay(100);
        digitalWrite(RESETLINE, 0);
      
        delay (3500);
      
        genie.WriteContrast(1);
        genie.WriteStr(0, GENIE_VERSION);
      }
      
      void loop()
      {
        genie.DoEvents();
      }
      
      void myGenieEventHandler(void)
      {
        genieFrame Event;
        genie.DequeueEvent(&Event);
      
        int slider_val0 = 0;
        int slider_val1 = 0;
        int slider_val2 = 0;
      
        if (Event.reportObject.cmd == GENIE_REPORT_EVENT)
        {
          if (Event.reportObject.object == GENIE_OBJ_TRACKBAR)
          {
            if (Event.reportObject.index == 0)
            {
              slider_val0 = genie.GetEventData(&Event);
              Serial.println ("Slider 0");
              Serial.print (slider_val0, DEC);
              Serial.println (" decimal");
              Serial.print (slider_val0, HEX);
              Serial.println (" hex");
              Serial.print (slider_val0, BIN);
              Serial.println (" binary");
      
            }
            if (Event.reportObject.index == 1)
            {
              slider_val1 = genie.GetEventData(&Event);
              Serial.println ("Slider 1");
              Serial.print (slider_val1, DEC);
              Serial.println (" decimal");
              Serial.print (slider_val1, HEX);
              Serial.println (" hex");
              Serial.print (slider_val1, BIN);
              Serial.println (" binary");
            }
            if (Event.reportObject.index == 2)
            {
              slider_val1 = genie.GetEventData(&Event);
              Serial.println ("Slider 2");
              Serial.print (slider_val2, DEC);
              Serial.println (" decimal");
              Serial.print (slider_val2, HEX);
              Serial.println (" hex");
              Serial.print (slider_val2, BIN);
              Serial.println (" binary");
            }
          }
        }
      }
      Last edited by James_4DSystems; 24 August 2015, 08:29 PM. Reason: Put in code box

      Comment


      • #4
        Yeah I just noticed a big typo in that code
        for slider 3 I call the variable for slider 1 *facepalm*
        sorry 'bout that, got 10 sliders working happily now.
        Last edited by Thebaconson; 24 August 2015, 08:31 PM.

        Comment


        • #5
          Think you need to have a read of the Stick post in the Arduino section

          http://forum.4dsystems.com.au/forum/...and-4d-display

          You are doing Serial.print statements to the same serial port you have connected to the 4D display.
          So you are sending your 'plain text' to the display, which is like sending chinese to someone who can only understand French, so you will be causing all sorts of grief for the display to try and understand.

          Get rid of all your serial print statements or use a difference serial port, and you will find all is well.

          Regards
          James

          Comment


          • #6
            Also, unless you have String0 object in your project (which you may), you need to get rid of
            the writeStr. If you do have it, its fine - you just havent posted your WS4 code for me to see.

            You cannot write to objects which dont exist.

            Regards
            James

            Comment

            Working...
            X