No announcement yet.

String manipulation

  • Filter
  • Time
  • Show
Clear All
new posts

  • #16

    Thanks Dave. I'm sure I'll have plenty of questions in the near future. I'll make an effort not to hijack a thread like I did here though.


    • #17
      i have a problem with string and button. I want every time i touch the screen, string will increase 1 unit. Could anyone please tell me how to do that?
      Here is my project. my problem is at form3.

      Thank you so much
      Attached Files


      • #18
        Good day huy373!

        The solution to your question can be broken down to these steps:

        1.) Button is pressed (Report message)
        2.) Increase value of the variable
        3.) Display value as string using the write str function

        Here is a sample code that you can use to your project:

        #include <genieArduino.h>
        #define RESETLINE 4 
        Genie genie;    //Create genie object
        int x = 0;
        void setup(){
          pinMode(RESETLINE, OUTPUT);    // Set D4 on Arduino to Output (4D Arduino Adaptor V2 - Display Reset)
          digitalWrite(RESETLINE, 1);    // Reset the Display via D4
          digitalWrite(RESETLINE, 0);    // unReset the Display via D4
          delay (3500);    //let the display start up after the reset (This is important)
          genie.AttachEventHandler(myGenieEventHandler); // Attach the user function Event Handler for processing events
        void loop() {
        genie.DoEvents(); // This calls the library each loop to process the queued responses from the display
        void myGenieEventHandler(void)
          genieFrame Event;
          genie.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_4DBUTTON)              // If the Reported Message was from a 4D BUTTON
              if (Event.reportObject.index == 0)                              // Place the index number of the 4D button
                x += 1;             // Increase the value of the variable
                genie.WriteStr(0, x);                // Write to the string, (0 is the index number of the string, x is the variable to be displayed)
        You can study further the Visi-Genie through the examples that can be found inside the Arduino Library.
        The strings implementation and report event implementation can be found in the examples.

        App notes and other tutorials regarding our products can be found in this link, just select the Visi-Genie
        in the Environment tick-box:

        Thank you,