music mixer code
Dependencies: mbed wave_player mbed-rtos SimpleRGB 4DGL-uLCD-SE PinDetect
Diff: touchpad.h
- Revision:
- 10:5f5e199e1b9c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/touchpad.h Mon Dec 09 16:43:04 2019 +0000 @@ -0,0 +1,26 @@ +// 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; +}