2.7 Touch Keys
Touch keys are capacitive touch sensors that detect the presence of a finger. They function like digital buttons without any mechanical movement. The IR remote included with the kit sends unique hexadecimal codes for each button, which can be mapped and used to trigger specific actions in your program.
IR Remote Key Mapping
Key | Code | Key | Code | Key | Code |
---|---|---|---|---|---|
A | 0xFFA25D | B | 0xFF629D | C | 0xFFE21D |
D | 0xFF22DD | ^ | 0xFF02FD | E | 0xFFC23D |
< | 0xFFE01F | ⚙ | 0xFFA857 | > | 0xFF906F |
0 | 0xFF6897 | v | 0xFF9867 | F | 0xFFB04F |
1 | 0xFF30CF | 2 | 0xFF18E7 | 3 | 0xFF7A85 |
4 | 0xFF10EF | 5 | 0xFF38C7 | 6 | 0xFF5AA5 |
7 | 0xFF42BD | 8 | 0xFF4AB5 | 9 | 0xFF52AD |
Example Applications
- Touch-sensitive control panels
- DIY electronic piano
- Interactive exhibits
2.7.1 Example Code for the Touch Keys
This example demonstrates how an IR remote can be used to control LEDs and trigger responses such as changing colors, displaying messages, and playing sounds. Each IR button sends a specific signal that is read through an IR receiver connected to pin P15. Depending on the signal received, the system performs a corresponding action.
- Start by attaching an IR receiver to any of the pins.
- Attach the external Piranha LED to any of the available pins.
- Set the chosen pin to
LOW
initially to prevent the LED from turning on before a button is pressed. - Inside the
forever
loop, the program continuously reads IR values from pinP15
. - If the A button (value
FFA25D
) is pressed:- All LEDs are turned off.
- Lamp 0 is set to red.
- The screen displays
Button A
. - A ringtone
ring_1
is played using the TTS Module.
- If the B button (value
FF629D
) is pressed:- All LEDs are turned off.
- An external LED on
P16
is set to HIGH. - The screen displays
Button B
. - The TTS Module speaks
"Light on"
.
- If the C button (value
FFE21D
) is pressed:- All LEDs are turned off.
- Lamp 2 is set to green.
- The screen displays
Button C
. - A different ringtone
ring_3
is played.
- If the D button (value
FF22DD
) is pressed:- All LEDs are turned off.
- An external LED on
P16
is set to LOW. - The screen displays
Button D
. - The TTS Module speaks
"Light off"
.

Figure 2.6.2a: IR Remote control logic in Mind+

Figure 2.6.2b: IR Remote control logic in Mind