help using arduino as kp3 controller

hi
im new to this technology, but i know that im not the first person to attempt what i am trying to achieve. I have an arduino unno board, a nintendo ds xl touch screen, a momentary switch, and a blinkM smart led. i want to assemble these and write a sketch that will allow the arduino to read data from the touch screen and momentary switch and send the data for control change on a korg kp3. As for the blinkM led, i want it to run through a ‘mood’ cycle alowing it to change colors at a slow speed, but change colors when the touch screen is in use (to change colors when the values of the touch screen change). I know that other people have done this before such as on these links: http://www.youtube.com/user/gazlang81#p/a/u/2/PTA6N8ILtsU
http://www.musewiki.com/Manson_M1D1_Black
On the first link you will notice that gareth uses an additional rotary encoder, i dont plan on using one in my setup.
Here is a copy of the sketch i have written so far

/*****************************************
// Jayke’s Midi Pad Code
//
//Reads a 4 wire touch screen and a momentary switch
//
//Sends serial data on channel 1 to a korg KP3
//
//Connect one pin of the switch to GND, the other to D9 on the
Arduino
//Connect the +X axis pin of the touch screen to AD0 on the arduino (a second
wire goes to 5v)
//Connect the -X axis pin of the touch screen to GND
//Connect the +Y axis pin of the touch screen to AD1 on the arduino (a second
wire goes to 5v)
//Connect the -Y axis pin of the touch screen to GND
//Connect one pin of blinkM smart LED to D3 on the arduino
//Connect one pin of blinkM smart LED to D5 on the arduino
//Connect one pin of blinkM smart LED to D6 on the arduino
//Connect one pin of blinkM smart LED to 5v
//
//Midi socket is connected as: (looking from behind at the pins)

//

//

// / 2 \ Pin 2 → GND

// ( 4 5 ) Pin 4 → 220ohm resistor → 5v

// \ 1 3 / Pin 5 → 220ohm resistor → Arduino TX Pin

// “”""" Pins 1 / 3 open

*****************************************/

#define analogPin0 0 // X axis of touch screen

#define analogPin1 1 // Y axis of touch screen

#define digitalPin9 9 // momentary switch

#define digitalPin3 3 // blinkM smart led red

#define digitalPin5 5 // blinkM smart led green

#define digitalPin6 6 // blinkM smart led blue

#define Debounce 30

int xaxsiValue = 0;

int yaxisValue = 0;

int switchValue = 0;

int blinkMRedValue = 0;

int blinkMGreenValue = 0;

int blinkMBlueValue = 0;

int switchState = 0;

int blinkled1ValueLast = 0;

int blinkled2ValueLast = 0;

int blinkled3ValueLast = 0;

int xaxisValueLast = 0;

int yaxisValueLast = 0;

byte i,valt;

void setup () {

Serial.begin(31250); // set MIDI baud rate

Serial.flush();

for (i = 2; i <=11;i++){ //turn on internal pullups for switches

digitalWrite(i, HIGH);

}

}

void loop() {

//Read momentary Switch

switchValue = digitalRead(digitalPin9);

if(switchValue ==LOW && switchState ==0){ //first press

switchState =1;

midiCC(0xB0, 0, 127); // sends effect hold on for korg kp3

delay(Debounce);

}

if(switchValue ==HIGH && switchState ==1){

switchState =2;

}

if(switchValue ==LOW && switchState ==2){ // second press

switchState =3;

midiCC(0xB0, 0, 0); // sends effect hold off for korg kp3

delay(Debounce);

}

if(switchValue ==HIGH && switchState ==3){

switchState =0;

}

//Read xaxis of touch screen

xaxisValue = analogRead(analogPin0);

if(xaxisValue != xaxisValueLast){

xaxisValue = map(xaxisValue,0,1016,0,127); //maps the value range of the xaxis to midi 0->127

midiCC(0xB0, 11, xaxisValue); // sends midi control change for kp3 touch pad x axis
// sends midi control change for led1 and led2 and led3

xaxisValueLast = xaxisValue;

}

//Read yaxis of touch screen

yaxisValue = analogRead(analogPin1);

if(yaxisValue != yaxisValueLast){

yaxis = map(yaxisValue,0,1016,0,127); //maps the value range of the yaxis to midi 0->127

midiCC(0xB0, 11 yaxisValue); // sends midi control change for kp3 touch pad y axis
// sends midi control change for led1 and led2 and led3

yaxisValueLast = yaxisValue;

}

I know that this sketch is incorrect only due to the fact that when i go to verifie it, the arduino program points out errors that i dont for the life of me know how to fix. If anyone out there can help me out in any way shape or form, then please do so. Im running out of ideas by the second.

Cheers

I know that this sketch is incorrect only due to the fact that when i go to verifie it, the arduino program points out errors that i dont for the life of me know how to fix.

Please modify your post. Select all of your code, and use the # button to add [ code ] and [ /code ] tags (without the spaces). This puts your code in a scroll box and makes it easier to read.

Second, post the errors that you get. They probably mean something to other people.

This is all the code i have at the moment. as for the errors, i cant post them as off yet due to the fact that im using a public computer to use the internet (i dont have access at home), i’ll post the errors i receive as soon as i copy them from my computer at home. i shoulod be able to post them tonight.

/*****************************************
// Jayke's Midi Pad Code
//
//Reads a 4 wire touch screen and a momentary switch
//
//Sends serial data on channel 1 to a korg KP3
//
//Connect one pin of the switch to GND, the other to D9 on the
Arduino
//Connect the +X axis pin of the touch screen to AD0 on the arduino (a second
wire goes to 5v)
//Connect the -X axis pin of the touch screen to GND
//Connect the +Y axis pin of the touch screen to AD1 on the arduino (a second
wire goes to 5v)
//Connect the -Y axis pin of the touch screen to GND
//Connect one pin of blinkM smart LED to D3 on the arduino
//Connect one pin of blinkM smart LED to D5 on the arduino
//Connect one pin of blinkM smart LED to D6 on the arduino
//Connect one pin of blinkM smart LED to 5v
//
//Midi socket is connected as: (looking from behind at the pins)

//

//   __---__

//  /  2  \   Pin 2 -> GND

//  ( 4  5 )   Pin 4 -> 220ohm resistor -> 5v

//  \ 1  3 /   Pin 5 -> 220ohm resistor -> Arduino TX Pin

//   """""     Pins 1 / 3 open

*****************************************/

#define analogPin0 0 // X axis of touch screen

#define analogPin1 1 // Y axis of touch screen

#define digitalPin9 9 // momentary switch

#define digitalPin3 3 // blinkM smart led red

#define digitalPin5 5 // blinkM smart led green

#define digitalPin6 6 // blinkM smart led blue

#define Debounce 30

int xaxsiValue = 0;

int yaxisValue = 0;

int switchValue = 0;

int blinkMRedValue = 0;

int blinkMGreenValue = 0;

int blinkMBlueValue = 0;

int switchState = 0;

int blinkled1ValueLast = 0;

int blinkled2ValueLast = 0;

int blinkled3ValueLast = 0;

int xaxisValueLast = 0;

int yaxisValueLast = 0;

byte i,valt;

void setup () {
  
  Serial.begin(31250);  // set MIDI baud rate
  
  Serial.flush();
  
  
  for (i = 2; i <=11;i++){ //turn on internal pullups for switches
   
   digitalWrite(i, HIGH);
   
  }

}

void loop() {
  
  //Read momentary Switch
  
  
  switchValue = digitalRead(digitalPin9);
  
  
  if(switchValue ==LOW && switchState ==0){ //first press
   
   switchState =1;
  
    midiCC(0xB0, 0, 127); // sends effect hold on for korg kp3
   
   delay(Debounce);
  
  }
 
  
  if(switchValue ==HIGH && switchState ==1){
    
    switchState =2;
  
  }
  
  if(switchValue ==LOW && switchState ==2){ // second press
   
   switchState =3;
    
    midiCC(0xB0, 0, 0); // sends effect hold off for korg kp3
   
   delay(Debounce);
  
  }
 
  if(switchValue ==HIGH && switchState ==3){
    
    switchState =0;
  
  }
  
  //Read xaxis of touch screen
  
  
  xaxisValue = analogRead(analogPin0);
  
  if(xaxisValue != xaxisValueLast){
    
    xaxisValue = map(xaxisValue,0,1016,0,127); //maps the value range of the xaxis to midi 0->127
   
   midiCC(0xB0, 11, xaxisValue); // sends midi control change for kp3 touch pad x axis
   // sends midi control change for led1 and led2 and led3
   
   xaxisValueLast = xaxisValue;
   
  }
  
  //Read yaxis of touch screen
  
  
  yaxisValue = analogRead(analogPin1);
  
  if(yaxisValue != yaxisValueLast){
    
    yaxis = map(yaxisValue,0,1016,0,127); //maps the value range of the yaxis to midi 0->127
   
   midiCC(0xB0, 11 yaxisValue); // sends midi control change for kp3 touch pad y axis
   // sends midi control change for led1 and led2 and led3
   
   yaxisValueLast = yaxisValue;
   
  }
  
  }

void midiCC(char command, char value1, char value2){
  Serial.print(command, BYTE);
  Serial.print(value1, BYTE);
  Serial.print(value2, BYTE);
}

if anyone has any ideas as to where i can improve my code or if i need to start over again, then please let me know. i need aall the help i can get

ok so i looked further at my code and re-wrote it to start with just a momentary switch to activate the hold function for now, i thought id get this out of the way first as it should be the easiest to do, so that way i can work on the touch screen in the meen time. can someone please give me an opinion on my new bit of code? it varifies and compiles, but i must have a value wrong somewhere along the lines because it doesnt do anything with the kp3

/*****************************************
// Jayke's Midi Pad Code
//
//Sends serial data on channel 1 to a korg KP3
//
//Connect one pin of the switch to GND, the other to D9 on the
Arduino
//
//Midi socket is connected as: (looking from behind at the pins)

//

//   __---__

//  /  2  \   Pin 2 -> GND

//  ( 4  5 )   Pin 4 -> 220ohm resistor -> 5v

//  \ 1  3 /   Pin 5 -> 220ohm resistor -> Arduino TX Pin

//   """""     Pins 1 / 3 open

*****************************************/


#define digitalPin9 9 // momentary switch


#define Debounce 30


int switchValue = 0;


int switchState = 0;


byte i,valt;

void setup () {
  
  Serial.begin(31250);  // set MIDI baud rate
  
  Serial.flush();
  
  
  for (i = 2; i <=11;i++){ //turn on internal pullups for switches
   
   digitalWrite(i, HIGH);
   
  }

}

void loop() {
  
  //Read momentary Switch
  
  
  switchValue = digitalRead(digitalPin9);
  
  
  if(switchValue ==LOW && switchState ==0){ //first press
   
   switchState =1;
  
    midiCC(0xB0, 0, 127); // sends effect hold on for korg kp3
   
   delay(Debounce);
  
  }
 
  
  if(switchValue ==HIGH && switchState ==1){
    
    switchState =2;
  
  }
  
  if(switchValue ==LOW && switchState ==2){ // second press
   
   switchState =3;
    
    midiCC(0xB0, 0, 0); // sends effect hold off for korg kp3
   
   delay(Debounce);
  
  }
 
  if(switchValue ==HIGH && switchState ==3){
    
    switchState =0;
  
  }
  
  
  }

void midiCC(char command, char value1, char value2){
  Serial.print(command, BYTE);
  Serial.print(value1, BYTE);
  Serial.print(value2, BYTE);
}