Announcement

Collapse
No announcement yet.

ViSi Genie keypad and Arduino code - Help!

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

  • ViSi Genie keypad and Arduino code - Help!

    I'm using uLCD-43PT to create a keypad for the first time, so i have several concerns:
    1-I don't know how to connect the code with the keypad, is it only by using Arduino genie library?
    2- what are the main functions that should be included in the code (if anyone can share a code example that would be very helpful)
    Moreover, this is what i have reached, but I'm not sure of its accuracy:

    #include <genieArduino.h>
    #include <Wire.h>
    #include <Keypad.h>

    #define Form1 0*01;
    int Winbutton1;
    const byte ROWS = 4; //four rows
    const byte COLS = 3; //three columns
    char keys[ROWS][COLS] = {
    {'1','2','3'},
    {'4','5','6'},
    {'7','8','9'},
    {'#','0','*'}
    };
    byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad
    byte colPins[COLS] = {8, 7, 6}; //connect to the column pinouts of the keypad

    Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

    void setup(){
    Serial.begin(9600);
    genieSetup (9600);
    }

    void loop(){

    genieWriteObj (GENIE_OBJ_FORM, 0, 0);
    char key = keypad.getKey();

    if (key != NO_KEY){
    Serial.println(key);
    }
    }

    void lcdUpdate(){
    genieWriteObj (GENIE_OBJ_INPUTS, 0, Keyboard1);
    genieWriteObj (GENIE_OBJ_BUTTONS, 0, Winbutton1);
    }
    }


    your help is appreciated,
    thanks
    Attached Files

  • #2
    have you set the keyboard widget to report message when the keyboard is pressed? the character will be sent to visi-genie arduino library as decimal, you may cast it to a character via (char) command on the output in the event handler, which, I don't see you have enabled in your sketch. Take a look at the example in the visigenie arduino to get an idea of how the event handler is setup and why DoEvents(); is needed in the loop, that will be the only way you'll get the keyboard characters seen by arduino

    also, keypad.h, and all those tables you added, are not even used in this case, they are not needed.

    Tony
    Last edited by tonton81; 24th April 2017, 03:23 AM.

    Comment


    • #3
      you select keyboard widget and in the widget properties edit the keyboard layout, you will get a popup with different keypads there

      Comment


      • #4
        Hello, i'm using arduino and uLCd 43DT, I don't know how to enter value from keypad. When i touch in a field, keypad will appear, and i can enter value to the field from keypad and press ENTER key to set parameters. PLease show me the code.

        Thanks and Best Regards,
        Huy

        Comment


        • #5
          Hi,

          This appnote may help, It shows how to create a keypad and how the keypad reports the values.

          http://www.4dsystems.com.au/appnote/4D-AN-00003/
          http://www.4dsystems.com.au/download...0003_R_1_0.pdf

          I hope this helps

          Best regards

          Paul

          Comment


          • huy373
            huy373 commented
            Editing a comment
            Thanks alot Paul. I will try my best.
        Working...
        X