music mixer code

Dependencies:   mbed wave_player mbed-rtos SimpleRGB 4DGL-uLCD-SE PinDetect

touchpad.h

Committer:
vamsatoor
Date:
2019-12-09
Revision:
10:5f5e199e1b9c

File content as of revision 10:5f5e199e1b9c:

// Touch Pad Sensor with I2C
#include <mbed.h>
#include <mpr121.h>

// Key hit/release interrupt routine

int key_code=0;

Mpr121 mpr121(&i2c, Mpr121::ADD_VSS);

void fallInterrupt()
{
    int i=0;
    int value=mpr121.read(0x00);
    value +=mpr121.read(0x01)<<8;
    // LED demo mod
    i=0;
    // puts key number out to LEDs for demo
    for (i=0; i<12; i++) {
        if (((value>>i)&0x01)==1) key_code=i+1;
    }
    led4=key_code & 0x01;
    led3=(key_code>>1) & 0x01;
    led2=(key_code>>2) & 0x01;
    led1=(key_code>>3) & 0x01;
}