Announcement

Collapse
No announcement yet.

Arduino uno and the uLCD-35DT

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

  • Arduino uno and the uLCD-35DT

    I've been able to creat the user interface that I want on the uLCD-35DT, using Visi-geni.

    Is there a download for a VERY BASIC example that initiates this LCD and demonstrates a simple button press and recognizing that the press has taken place on the Arduino side.

    I just need a working example to get me started so I can understand the how things are called and read write,.... seems a bit more complicated than the Arduino IDE... but that's just me, I guess.

    Be gentle folks.... I'm old and confuse easily ;>}

  • #2
    good morning dakman, 4DSystems have a new beta with examples you could try out to get familiar with visi genie

    https://github.com/4dsystems/ViSi-Ge...o-Library-BETA

    any assistance/problems let us know

    Tony

    Comment


    • #3
      OK, I've loaded the string example and tried to compile it, I get an error at genie.WriteStr(0, "TEST")

      error genie was not declared in this scope

      I guess I would assume that this supplied code would work without errors.... or am I missing some library item?

      NOTE: I did add the string object as stated in the commented area of the code.

      Tag, you're it!

      Comment


      • #4
        writestr compiles fine here from the repo

        did you change anything? are you using serial0 of the uno? if so you dont need to change anything in the sketch for it to work

        also, on the header of the example itll tell you to load a string box on the lcd so then the arduino will write to it
        make sure the baud rates match both on the arduino and workshop
        Last edited by tonton81; 8th August 2017, 04:02 AM.

        Comment


        • #5
          Hello,

          Did you manage to change to the new Visi-genie library. If you did, can you please check that you removed the old genieArduino folder and also make sure that line 17 in the string example isn't altered.

          You will get this error if this command on line 17 is missing or changed

          Genie genie;

          I hope this helps

          Best regards

          Paul

          Comment


          • #6
            OK , I seem to have some of the basics working , able to increment the digLED, and write to the string object but I'm still confused about knowing when a button event occurs and how to handle it.
            Click image for larger version

Name:	snap.png
Views:	80
Size:	47.9 KB
ID:	59209

            .... If someone can show me how and where to get the button event thing happening, I'm sure I'll be able to figure out how to use it in my project...
            Again, I know this is simple stuff and I'm sure there is a lot of laughter here, but all I need here is a nudge to get me going.... Thanks in advance!

            here are the object names for the two buttons I'm trying to use.
            4Dbutton0(myRunButton)
            4Dbutton1(myPauseButton)



            here is my code thus far

            #include <genieArduino.h>

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

            Genie genie;

            int Cycle_minutes = 1;
            int seconds = 0; // track count down seconds
            int minutes; // tracks count down minutes
            long int numberOfRotations=0; // tracks number of completed Rotations

            void setup()
            {
            Serial.begin(115200);
            genie.Begin(Serial);

            // 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(200);
            digitalWrite(RESETLINE, 0); // unReset the Display via D4
            delay (3500); //let the display start up after the reset (This is important)
            genie.WriteContrast(15); // 1 = Display ON, 0 = Display OFF

            numberOfRotations++;
            minutes = Cycle_minutes;
            turningTheCrank();
            myRotations();

            }

            void loop()
            {
            seconds = seconds-1;

            if(seconds <= 0){
            minutes = minutes - 1;
            if(minutes == -1){
            turningTheCrank();
            numberOfRotations++;
            myRotations();
            minutes =Cycle_minutes-1;
            seconds =60;
            }
            else
            {
            seconds = 60;
            }
            }
            genie.WriteObject(GENIE_OBJ_LED_DIGITS,0,minutes);
            genie.WriteObject(GENIE_OBJ_LED_DIGITS, 1, seconds );
            delay(1000);
            genie.DoEvents();
            }



            void myRotations()
            {
            String junk="rotations = " + String(numberOfRotations);
            genie.WriteStr(0,junk);
            }

            void turningTheCrank(){ // will be adding servo motor control here
            String junk=("Turning the Crank");
            genie.WriteStr(0,junk);
            delay (3000);
            junk = " ";
            genie.WriteStr(0,junk);


            }


            /*
            void myGenieEventHandler(void) // stuff lifted from examples and hacked up by me.....sorry
            {
            genieFrame Event;
            genie.DequeueEvent(&Event);

            //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_LED) // If the Reported Message was from a Slider
            {
            if (Event.reportObject.index == 0) // If Slider0
            {
            erial.println("button pressed");
            //slider_val = genie.GetEventData(&Event); // Receive the event data from the Slider0
            }
            }
            }
            }
            */

            /********** This can be expanded as more objects are added that need to be captured *************
            *************************************************************************************************
            Event.reportObject.cmd is used to determine the command of that event, such as an reported event
            Event.reportObject.object is used to determine the object type, such as a Slider
            Event.reportObject.index is used to determine the index of the object, such as Slider0
            genie.GetEventData(&Event) us used to save the data from the Event, into a variable.
            *************************************************************************************************/


            Comment


            • #7
              please send your zipped project on here as an attachment so we can verify if the events are properly being set in the code, so we could also align it with your sketch, i also see a handler code issue in your sketch, but im sure we can get you up and running with a few events and you'll know how to add more if needed

              Tony
              Last edited by tonton81; 11th August 2017, 01:42 AM.

              Comment


              • #8
                Here's my zipped project geni and arduino...... thanks for the helping hand here... greatly appreciated!
                Attached Files

                Comment


                • #9
                  no problem give me a few minutes i will also optimize your code

                  Comment


                  • #10
                    here you go (and only 11 minutes later...), no delays in loop please use the latest beta library at github

                    https://github.com/4dsystems/ViSi-Ge...o-Library-BETA


                    Tony
                    Attached Files
                    Last edited by tonton81; 11th August 2017, 02:36 AM.

                    Comment


                    • #11
                      TonTon81,,, your attached zipped file does nothing on my end, opens another tab with a blank page. ....I guess i'm doing some wrong here...

                      Comment


                      • #12
                        refresh the page if its blank, it's your browser's cache, usually logging in and refreshing the page opens the download
                        your already logged in if your posting here, so try hitting F5 on the page to refresh or try another browser

                        Tony

                        Comment


                        • #13
                          got it...will try it out and let you know how it's going ...thanks!

                          Comment


                          • #14
                            so simple it made me cry..... thanks.... my next venture will be a second form and using the buzzer...... we'll see how that goes.... Thanks again for teaching the OLD Dog, a NEW trick.

                            Comment


                            • #15
                              tonton81,

                              not sure why, but all of the sudden, the routine is running very slow... each second seems to be doubled and when I press a button, there is a few second lag time before it's recognized.... my baud is at 115200 and should be fast enough.... note : it seemed to run at the correct speed when I first tried your code, but all I did was add a Boolean, isStopped, at the:

                              if ( millis() - cycle_delay > 1000 && isStopped==false) {

                              also added a WriteStr so as to see which button was pressed.

                              if (Event.reportObject.cmd == GENIE_REPORT_EVENT && Event.reportObject.object == GENIE_OBJ_4DBUTTON ) {
                              if (Event.reportObject.index == 0) { // if button 0, do something
                              junk2 = ("Pressed RUN");
                              genie.WriteStr(0, junk2);
                              delay(2000);
                              isStopped= false; // release the timer to continue where it left off
                              junk2 = "rotations = " + String(numberOfRotations);
                              genie.WriteStr(0, junk2);

                              }
                              if (Event.reportObject.index == 1) { // if button 1, do something
                              junk2 = ("Pressed PAUSE");
                              genie.WriteStr(0, junk2);
                              isStopped = true;
                              }
                              }

                              Comment

                              Working...
                              X