- Description
- Technical Documents
- Guidance videos
- Reviews
- Shipping & Returns
Product Name: 3-5V 4 Buttons AD Keypad keyboard Analog output button for Arduiuo nano 3 breadboard stm32 starter kit
Packing list:
4 key Analog Buttons( With Pin Header )
Description:
Ideal for linking up to your Ardiuno UNO Mini Nano Mega2560 etc,or others MCU ( AVR STM32 ARM7 ARM9 ARM10 PIC AT89C51 STC MSP430 FPGA CPLD raspberry pi etc.)
Circuit schematics :
Connection with Arduiuo :
Arduiuo uno/mega2560 Code
//******************************************************//
/*
Arduiuo_4 key analog Buttons
This example code is in the public domain.
*/
#define key1ValueMin 96
#define key1ValueMax 106
#define key2ValueMin 144
#define key2ValueMax 159
#define key3ValueMin 193
#define key3ValueMax 213
#define key4ValueMin 242
#define key4ValueMax 255
int adPin = A0; // select the input pin for the potentiometer
int keyValue;
int keyValue_r;
int keyValue_rr;
//key scan
int key_scan(void)
{
int adValue;
int key;
adValue = analogRead(adPin);//read ad Value
adValue = adValue / 4;
if(adValue >= key1ValueMin && adValue <= key1ValueMax)// k1
{
key = 1;
}
else if(adValue >= key2ValueMin && adValue <= key2ValueMax)// k2
{
key = 2;
}
else if(adValue >= key3ValueMin && adValue <= key3ValueMax)// k3
{
key = 3;
}
else if(adValue >= key4ValueMin)// k4
{
key = 4;
}
else //Invalid value
{
key = 0;
}
return key;
}
void setup() {
Serial.begin(9600);
}
void loop() {
//Save three key scan value
keyValue_rr = keyValue_r;
keyValue_r = keyValue;
keyValue = key_scan();
//Three scanned values are the same, indicating that key is valid
if(keyValue > 0 && keyValue==keyValue_r && keyValue_r==keyValue_rr)
{
Serial.print(''keyValue = '');
Serial.println(keyValue);
}
delay(100); //Each scan interval 100-200MS
}
//******************************************************//
* Delivery Time.
We need 1-2 days to process your order before shipping.There are two shipping methoed. Fast Delivery: The delivery time for US, European countries the delivery will take 3-5 days.Slow Delivery: The delivery time for US, European countries the delivery will take 10-15 days.
* Tracking information.
After we ship package, customer receive automatic email with tracking details.
* Lost Package Policy.
If a package did not arrive in 4 weeks after the shipping date, then this package is treated as Lost. In this case a new package will be shipped to the customer provided we are able to give the same items as those purchased by the customer. If we are not able to provide the same items to substitute the lost ones we will either propose to the customer similar items or refund their cost as it will be mutually agree with the customer. If one or more items neither the same nor similar are available to be shipped, the customer can request to cancel the order entirely, thus the total cost of the order including shipping and handling cost will be fully refunded.