×

With the recent surge in Omicron cases, shipping may be slower than stated times. We are working to build, ship and respond to everything as quickly as possible. Please see all COVID-19 updates here. Thank you for your continued support.

Member #400194

Member Since: January 20, 2013

Country: United States

  • It did not run correctly on any of my boards (Leonardo, Due). Thus, I dumped the library, determined the analogRead values for every key (which might be different per board), increase them a little bit (about 10 points) and use the following program adapted from DFrobot example code to use the five buttons on the Romeo, but added a threshold of 20, because the keyboard is noisy:

    int key=-1;
    int oldkey=-1;
    int adc_key_val [12] = {45,85,125,170,215,260,300,345,380,425,470,510};
    int adc_key_in;
    
    
    void setup()
    {
     Serial.begin(9600);  
    }
    
    void loop(){ 
      delay(50);   
      adc_key_in=analogRead(0);
      key=get_key(adc_key_in);
     if ((key != oldkey) && (key !=-1)){ Serial.println(key);}
     oldkey=key;
    }
    
    
     int get_key(unsigned int input){
     int k;
    for (k=0; k<12; k++){
      if (input<20){k=-1; return k;}
      if (input<adc_key_val[k]){k=12-k; return k;}
      if (k>=12){k=-1;return k;}
      }
    }
    

No public wish lists :(