However what I'm trying to accomplish is for each trigger to actually do 2 key presses at once.
Example E0 would then trigger 'Z + KEY_RIGHT_ARROW'
E1 Would then trigger 'A + KEY_RIGHT_ARROW'
First of all, is this possible by modifying the 'const char keymap'
const char keyMap[12] = {'J', 'U', 'H', 'Y', 'G', 'T', 'F', 'D', 'E', 'S', 'W', 'A'};
If not, is it possible to add a press and release function to this code so on press it would do 'Z' and on release it would do 'KEY_RIGHT_ARROW'?
Sorry for my lack of knowledge on the matter but have been chucked in the deep end at work, and am looking for an easy solution.
This is the touch board, made by "Bare Conductive" : Touch Board – Bare Conductive.
Do they have Arduino code on their website? or perhaps schematics?
Sparkfun sells it as well: Bare Conductive Touch Board - DEV-13298 - SparkFun Electronics.
And Sparkfun has a schematic
It is a very expensive Arduino Leonardo compatible board with the MPR121 for touch and a VS1053b for sound and a SD memory card socket.
Was it a Christmas gift ? I think that money could be spent in a better way.
When you want to make music with a simple Arduino board, you could try the Mozzi library: Mozzi.
Your link to the gist seems to be a sketch from "Bare Conductive", did you upload that ?
Bare Conductive do have their own Github section.
I suggest to use their MPR121 library, and try a few of the examples that come with it: GitHub - BareConductive/mpr121: Bare Conductive MPR121 Arduino Library
It seems that there are 12 pins, and the examples assume that the pins are 0 to 11. The MPR121.isNewTouch() and the MPR121.isNewRelease() tell if that specific pin was touched or released.
For a quick and dirty solution, you could try the Keyboard.write() to send a key at pressing and at releasing.
Using the Keyboard.press() when pressing a button and a Keyboard.release() when releasing a button is better. You might need those two functions when you want a combination of keys pressed at the same time.
The key 'E' is number 8 ?
You could filter number 8 out of it, and let the rest do the old sketch.
for( int i=firstPin; i<=lastPin; i++)
{
if( MPR121.isNewTouch( i))
{
digitalWrite( LED_BUILTIN, HIGH);
// test if it is our special number 8 key 'E'
if( i == 8)
{
Keyboard.write( 'Z');
}
else
{
Keyboard.press( keyMap[i]);
if( !holdKey)
Keyboard.release( keyMap[i]);
}
}
else if( MPR121.isNewRelease( i))
{
// test if it is our special number 8 key 'E'
if( i == 8)
{
Keyboard.write( KEY_RIGHT_ARROW);
}
else
{
if( holdKey)
Keyboard.release(keyMap[i]);
}
digitalWrite(LED_BUILTIN, LOW);
}
}