pass elements of global variable array from keypad in arduino : Currently elements of array a1[2] is initialised in the code but I want to pass this element of global variable array " a1[2] "from keypad as v1.  here is my code.



    #include "Keypad.h"
    #include <LiquidCrystal.h>

    unsigned int a1[2]={1,10}; //global variable

    //unsigned int a1[2] = {1,v1} //not working

    /.. 
    
    keypad initialization

    .../

    void setup() {

    lcd.begin(16, 2);
  
    lcd.clear();
    lcd.setCursor(1,1);
    lcd.print("Press # to GO");
    lcd.setCursor(0,0);
    lcd.print("Enter v1: ");
    v1 = GetNumber();
   
    }

    void loop()
    {
  
    ...
 
    }


    int GetNumber()
    {
     ...
     ....
      
    }

    return num;
    }

pls help in this code.





