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
      Hello,
      Can i ask something? I have a problem with keypad. I don't know where to find it? Please show me. Thank you very much.

      Comment


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

        Comment

        Working...
        X