- -43%
10 DB UNO MEGA2560 példakóddal! 3.3V 5V 4 gomb 1 Analóg kimenet AD billentyűzet billentyűzet gomb Arduinohoz
10 DB UNO MEGA2560 példakóddal! 3.3V 5V 4 gomb 1 Analóg kimenet AD billentyűzet billentyűzet gomb Arduinohoz
1 210 Ft
43% megtakarítás
2 122 Ft
Nincs adó
Product Name:10PCS with UNO MEGA2560 example Code ! 3.3V 5V 4 Buttons 1 Analog output AD Keypad keyboard button for Arduiuo
Packing list:
10 p cs 4 key Analog Buttons( With Pin Header )
Description:
1 Power Supply Voltage : 3-5V
2 4 Buttons 1 Analog Output(AD Pin)
3 PCB Size : 30x12mm
4 Weight : 1.8g
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 UNO :
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
}
//******************************************************//
Packing list:
10 p cs 4 key Analog Buttons( With Pin Header )
Description:
1 Power Supply Voltage : 3-5V
2 4 Buttons 1 Analog Output(AD Pin)
3 PCB Size : 30x12mm
4 Weight : 1.8g
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 UNO :
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
}
//******************************************************//
Biztonsági feltételek
Szállításii feltételek
Visszaküldési feltételek