Octopus ADKeypad

From ELECFREAKS-WIKI
Jump to: navigation, search

Introduction

Octopus Electronic Bricks, you can use them build electronics projects just as easy as piling bricks. By using Octopus electronic bricks, you may connect Arduino/Freaduino compatible boards easily with various digital, analog and I2C/Uart interfaces. These the breadboard-less firm connection are prepared to extensive modules like poteniometers, sensors, relays, servos…even buttons, just plug and play.

This keyboard uses an analog input to read the five key state which saves IO resource for the Arduino. It can be used together with our I/O expansion boards to make amazing interactive project.

ADKey board A.jpg ADKey board B.jpg

Model: EF04017

Feature

  • Supply voltage: voltage controller
  • Interface: Analog
  • Size: 55x29mm

Schematic

ADKey board E.jpg


Soil-OB-05.jpg

Specification

Pin definition and Rating

GND VCC Signal
GND VCC Signal

Usage

  • 3P buckled wires connector

Soil-OB-07.jpg


Hardware Installation

Octopus ADKeypad.jpg


Programming

Includes important code snippet. Demo code like :

<syntaxhighlight lang="php">

//ADKeyboard Module int adc_key_val[5] ={20,50, 100, 200, 600 }; int NUM_KEYS = 5; int adc_key_in; int key=-1; int oldkey=-1; void setup() {

 pinMode(13, OUTPUT);  //we'll use the debug LED to output a heartbeat
 Serial.begin(9600); // 9600 bps

} void loop() {

 adc_key_in = analogRead(0);    // read the value from the sensor 
 digitalWrite(13,LOW); 
 key = get_key(adc_key_in);  // convert into key press

 if (key != oldkey)   // if keypress is detected
  {
   delay(50);  // wait for debounce time
   adc_key_in = analogRead(0);    // read the value from the sensor 
   key = get_key(adc_key_in);    // convert into key press
   if (key != oldkey)    
   {   
     oldkey = key;
     if (key >=0){
       digitalWrite(13,HIGH);
       switch(key)
       {
          case 0:Serial.println("S1 OK");   
                 break;
          case 1:Serial.println("S2 OK");   
                 break;
          case 2:Serial.println("S3 OK");   
                 break;
          case 3:Serial.println("S4 OK");   
                 break;      
          case 4:Serial.println("S5 OK");   
                 break;  
       }                
     }
   }
 }
delay(100);

} // Convert ADC value to key number int get_key(unsigned int input) {

   int k;
   for (k = 0; k < NUM_KEYS; k++)
   {
     if (input < adc_key_val[k])
    {
           return k;
       }
  }
      if (k >= NUM_KEYS)k = -1;  // No valid key pressed
      return k;

}

</syntaxhighlight>

Example

The projects and application examples.

ADKey board D.JPG

ADKey board C.JPG


OB.jpg

Soil-OB-06.jpg



SHD IOE01 6.jpg


PushButtonS-07.jpg

Version Tracker

Revision Descriptions Release
v1.0b Initial public release date

Bug Tracker

Bug Tracker is the place you can publish any bugs you think you might have found during use. Please write down what you have to say, your answers will help us improve our

products.

Resources

How to buy

Click here to buy: http://www.elecfreaks.com/estore/octopus-adkeypad.html

See Also

Other related products and resources.

Licensing

This documentation is licensed under the Creative Commons Attribution-ShareAlike License 3.0 Source code and libraries are

licensed under GPL/LGPL, see source code files for details.

External Links

Links to external webpages which provide more application ideas, documents/datasheet or software libraries