MCU-122 MPR121 모듈 용량 터치 센서 키 센서 키 키보드스토어 가기

MCU-122 MPR121 모듈 용량 터치 센서 키 센서 키 키보드

₩ 1,324 ¥ 6.5

색상:

  • 레드 보드 * MPR121 모듈

크기:

수량:
- +
재고:

최소 주문 수량: 1

알리타플은 고객님께서 주문한 물건을 그대로 구매대행 해드립니다.
궁금한 사항이 있으시면 언제든 고객센터로 연락주세요.

1688온라인 사이트에서 검색된 상품입니다. 알리타플에서는 상품검색/현지구매(구매대행)/국제배송 업무만 제공해드립니다. 해당 상품의 품질 및 상태에 대해서는 확인해 드릴 수 없고 해당 물건이 입고가 된 후에 검수과정을 거쳐야 확인이 가능합니다.

상세페이지


1379(1)



型号:MCU-122

MPR121模块 电容式 触摸 传感器 按键 感应按键 键盘

尺寸:48mm*78mm

Description: The MPR121 capacitive keypad uses the MPR121 and 12 touch sensitive pads to give you a simple 'keypad' with an I2C output. The board also has four mounting holes allowing it to be used as an input system in place of traditional buttons. Check the example code below for an easy way to read the keypad. cjmcu.

Note: This keypad outputs 3.3V logic. If you are using a board which only accepts 5V logic, you will run into a problem. You will want to use a logic level converter, or a board which accepts 3.3V logic.

===================================================================

/* MPR121 Keypad Example Phone Dialing Code
 by: Jim Lindblom
     SparkFun Electronics
 created on: 1/6/10
 license: CC-SA 3.0
 
 Turns the MPR121 Touchpad into a phone keypad. Pressing a pad will
 print a 0-9, * or #.
 
 Hardware: 3.3V Arduino Pro Mini
           SDA -> A4
           SCL -> A5
           IRQ -> D2
           
 I wasn't having any luck using the Wire.h library, so I've adapted
 I2C code from an ATmega328 library to get this working.
 If you can get this working with the Wire.h library, I'd be thrilled to hear!
*/
 
#include "mpr121.h"
#include "i2c.h"
 
#define MPR121_R 0xB5// ADD pin is grounded
#define MPR121_W 0xB4// So address is 0x5A
 
#define PHONE_DIGITS 10  // 10 digits in a phone number
 
// Match key inputs with electrode numbers
#define STAR 0
#define SEVEN 1
#define FOUR 2
#define ONE 3
#define ZERO 4
#define EIGHT 5
#define FIVE 6
#define TWO 7
#define POUND 8
#define NINE 9
#define SIX 10
#define THREE 11
 
int irqpin = 2;  // D2
 
uint16_t touchstatus;
char phoneNumber[PHONE_DIGITS];
 
void setup()
{
  pinMode(irqpin, INPUT);
  digitalWrite(irqpin, HIGH);
  
  Serial.begin(9600);
  DDRC |= 0b00010011;
  PORTC = 0b00110000;  // Pull-ups on I2C Bus
  i2cInit();
  
  delay(100);
  mpr121QuickConfig();
}
 
void loop()
{
  getPhoneNumber();
  
  Serial.print("\nDialing... ");
  for (int i=0; i
    Serial.print(phoneNumber[i]);
  
  while(1)
    ;
}
 
void getPhoneNumber()
{
  int i = 0;
  int touchNumber;
  
  Serial.println("Please Enter a phone number...");
  
  while(i
  {
    while(checkInterrupt())
      ;
    touchNumber = 0;
    
    touchstatus = mpr121Read(0x01) << 8;
    touchstatus |= mpr121Read(0x00);
    
    for (int j=0; j<12; j++)  // Check how many electrodes were pressed
    {
      if ((touchstatus & (1<
        touchNumber++;
    }
    
    if (touchNumber == 1)
    {
      if (touchstatus & (1<
        phoneNumber[i] = '*';
      else if (touchstatus & (1<
        phoneNumber[i] = '7';
      else if (touchstatus & (1<
        phoneNumber[i] = '4';
      else if (touchstatus & (1<
        phoneNumber[i] = '1';
      else if (touchstatus & (1<
        phoneNumber[i] = '0';
      else if (touchstatus & (1<
        phoneNumber[i] = '8';
      else if (touchstatus & (1<
        phoneNumber[i] = '5';
      else if (touchstatus & (1<
        phoneNumber[i] = '2';
      else if (touchstatus & (1<
        phoneNumber[i] = '#';
      else if (touchstatus & (1<
        phoneNumber[i] = '9';
      else if (touchstatus & (1<
        phoneNumber[i] = '6';
      else if (touchstatus & (1<
        phoneNumber[i] = '3';
        
      Serial.print(phoneNumber[i]);
      i++;
    }
    else if (touchNumber == 0)
      ;
    else
      Serial.println("Only touch ONE button!");
  }
}
 
byte mpr121Read(uint8_t address)
{
  byte data;
  
  i2cSendStart();
  i2cWaitForComplete();
  
  i2cSendByte(MPR121_W);// write 0xB4
  i2cWaitForComplete();
  
  i2cSendByte(address);// write register address
  i2cWaitForComplete();
  
  i2cSendStart();
  
  i2cSendByte(MPR121_R);// write 0xB5
  i2cWaitForComplete();
  i2cReceiveByte(TRUE);
  i2cWaitForComplete();
  
  data = i2cGetReceivedByte();// Get MSB result
  i2cWaitForComplete();
  i2cSendStop();
  
  cbi(TWCR, TWEN);// Disable TWI
  sbi(TWCR, TWEN);// Enable TWI
  
  return data;
}
 
void mpr121Write(unsigned char address, unsigned char data)
{
  i2cSendStart();
  i2cWaitForComplete();
  
  i2cSendByte(MPR121_W);// write 0xB4
  i2cWaitForComplete();
  
  i2cSendByte(address);// write register address
  i2cWaitForComplete();
  
  i2cSendByte(data);
  i2cWaitForComplete();
  
  i2cSendStop();
}
 
void mpr121QuickConfig(void)
{
  // Section A
  // This group controls filtering when data is > baseline.
  mpr121Write(MHD_R, 0x01);
  mpr121Write(NHD_R, 0x01);
  mpr121Write(NCL_R, 0x00);
  mpr121Write(FDL_R, 0x00);
 
  // Section B
  // This group controls filtering when data is < baseline.
  mpr121Write(MHD_F, 0x01);
  mpr121Write(NHD_F, 0x01);
  mpr121Write(NCL_F, 0xFF);
  mpr121Write(FDL_F, 0x02);
  
  // Section C
  // This group sets touch and release thresholds for each electrode
  mpr121Write(ELE0_T, TOU_THRESH);
  mpr121Write(ELE0_R, REL_THRESH);
  mpr121Write(ELE1_T, TOU_THRESH);
  mpr121Write(ELE1_R, REL_THRESH);
  mpr121Write(ELE2_T, TOU_THRESH);
  mpr121Write(ELE2_R, REL_THRESH);
  mpr121Write(ELE3_T, TOU_THRESH);
  mpr121Write(ELE3_R, REL_THRESH);
  mpr121Write(ELE4_T, TOU_THRESH);
  mpr121Write(ELE4_R, REL_THRESH);
  mpr121Write(ELE5_T, TOU_THRESH);
  mpr121Write(ELE5_R, REL_THRESH);
  mpr121Write(ELE6_T, TOU_THRESH);
  mpr121Write(ELE6_R, REL_THRESH);
  mpr121Write(ELE7_T, TOU_THRESH);
  mpr121Write(ELE7_R, REL_THRESH);
  mpr121Write(ELE8_T, TOU_THRESH);
  mpr121Write(ELE8_R, REL_THRESH);
  mpr121Write(ELE9_T, TOU_THRESH);
  mpr121Write(ELE9_R, REL_THRESH);
  mpr121Write(ELE10_T, TOU_THRESH);
  mpr121Write(ELE10_R, REL_THRESH);
  mpr121Write(ELE11_T, TOU_THRESH);
  mpr121Write(ELE11_R, REL_THRESH);
  
  // Section D
  // Set the Filter Configuration
  // Set ESI2
  mpr121Write(FIL_CFG, 0x04);
  
  // Section E
  // Electrode Configuration
  // Enable 6 Electrodes and set to run mode
  // Set ELE_CFG to 0x00 to return to standby mode
  mpr121Write(ELE_CFG, 0x0C);// Enables all 12 Electrodes
  //mpr121Write(ELE_CFG, 0x06);// Enable first 6 electrodes
  
  // Section F
  // Enable Auto Config and auto Reconfig
  /*mpr121Write(ATO_CFG0, 0x0B);
  mpr121Write(ATO_CFGU, 0xC9);// USL = (Vdd-0.7)/vdd*256 = 0xC9 @3.3V   mpr121Write(ATO_CFGL, 0x82);// LSL = 0.65*USL = 0x82 @3.3V
  mpr121Write(ATO_CFGT, 0xB5);*/// Target = 0.9*USL = 0xB5 @3.3V
}
 
byte checkInterrupt(void)
{
  if(digitalRead(irqpin))
    return 1;
 
  return 0;
}

 

 

1379 (10)

1379 (1)

1379 (4)

1379 (9)

1379 (11)

상호: 주식회사 와이지넷코리아 (YOUNG GROUP NET KOREA CO., LTD.)    대표: 주용규    사업자등록번호: 223-81-14426   
통신판매업신고번호: 제 2015-서울강남-02499호 주소: 서울시 강남구 테헤란로4길 6, 1718호   
TEL:(배송확인) 070-5001-0885    (업무상담) 070-4337-1714    업무제휴문의:ygnkorea@gmail.com

웨이하이센터상호: 威海韩运国际贸易有限公司 法定代表人: 朱 勇奎 统一社会信用代码: 91371000MA3U6XGW6N 进出口: 37109409C6
(264200) 山东省 / 威海市 / 环翠区 / 西苑街道 / 贝卡尔特路91-2号 / 威广物流园西门 / 韩运国际贸易 TAPL
TEL : +86) 0631- 598 -1400    FAX : +86) 0631- 598 -1144
TAPL Hanyun International Trade , West Gate of Weihai Logistics Park, Bekart Road-91, Xiyuan Street, Huancui District, Weihai City, Shandong Province,CHINA (ZIPCODE 264200)
Copyright© 2023-2024 alitapl.com All Rights Reserved