guitar frequencies

Hi PaulS

thanks for help, may be "a strang car again" sorry, I am new for using farum.
the hardware I am using, I explained before here: guitar frequencies - #15 by system - Programming Questions - Arduino Forum
I get some code from this public domain: Tony Chai wrote by Tony Chai
I don,t need to to use servo or tuning peg, indstead I am using electromegnet and coils to vibrate the string, just visualizing frequency. my vibration hardware circuit I put here

here is the code

/*
 * Magic_Tune
 *
 * This program will receive an amplified analog signal, compare the pitch, and control the servo motor while displaying output LEDs
 */


//Libraries required for servo control and usage of the Atmega’s internal timer
 #include 
#include "WProgram.h"

//Global variables to be used
 int x;
 int y;
 int lastx;
 int lasty;
 long timer;
 int idle_timer;
 int threshold;
 int cross_count;
 int in_tune;
 int average_val;
 int pitch_diff;

int upper_bound;
 int lower_bound;
 int avg_cross;
 int avg_counter;
 int avg_upper;
 int avg_lower;
 float a, b;

int timer_divide;
 int divide_by;

int string_select;
 int select_pin_val;

int analogPin = 0; // analog to digital pin for signal input

int led_high = 13; // this LED will show user if a string's pitch is too high
 int led_ok = 12; // this LED will show user if a string's pitch is correct
 int led_low = 11; // this LED will show user if a string's pitch is too low

// these pins will light up to show which string the Atmega is comparing values for
 int led_e4 = 10;
 int led_b3 = 9;
 int led_g3 = 8;
 int led_d3 = 7;
 int led_a2 = 6;
 int led_e2 = 5;

int button_pin = 3; // input pin for user using a button to switch strings
 int servoPin = 2; // control pin for servo motor

void setup()
 {
 // Set up timer 1 to generate an interrupt every 1 microsecond
 TCCR1A = 0x00;
 TCCR1B = (_BV(WGM12) | _BV(CS12));
 OCR1A = .071;
 TIMSK1 = _BV(OCIE1A);

 x = 0;
 lastx = 0;
 y = 0;
 lasty = 0;

 timer = 0;
 cross_count = 0;
 avg_cross = 0;
 avg_counter = 0;
 string_select = 0;

 //Set the input and output pins
 pinMode(button_pin, INPUT);
 pinMode(servoPin, OUTPUT);
 pinMode(led_high, OUTPUT);
 pinMode(led_ok, OUTPUT);
 pinMode(led_low, OUTPUT);
 pinMode(led_e4, OUTPUT);
 pinMode(led_b3, OUTPUT);
 pinMode(led_g3, OUTPUT);
 pinMode(led_d3, OUTPUT);
 pinMode(led_a2, OUTPUT);
 pinMode(led_e2, OUTPUT);

 Serial.begin(9600); // Opens serial port, sets data rate to 9600 bps
 }

// Nothing is done in the Arduino loop, since timing is off.
 void loop()
 { 
}

// Timer function running every microsecond
 ISR(TIMER1_COMPA_vect)
 {
 timer++;
 idle_timer++;

 // Read button press to determine which string is to be detected
 if (timer % 100 == 0)
 {
 select_pin_val = digitalRead(button_pin);
 if (select_pin_val == HIGH)
 {
 string_select = ((string_select + 1) % 6);
 Serial.print("string: ");
 Serial.println(string_select);
 }
 }


 // Depending on which string is selected, the proper variables are set
 switch (string_select)
 {
 case 0:
 digitalWrite(led_e4, LOW); // sets the proper LED on, all else off
 digitalWrite(led_b3, LOW);
 digitalWrite(led_g3, LOW);
 digitalWrite(led_d3, LOW);
 digitalWrite(led_a2, LOW);
 digitalWrite(led_e2, HIGH);
 a = 0.045;
 b = 0.9099;
 threshold = 150;
 upper_bound = 77;
 lower_bound = 33;
 avg_upper = 57;
 in_tune = 55; // This is the “in tune” average of cross counts for the string.
 avg_lower = 53;
 timer_divide= 2000;
 divide_by = 3;
 break;
 case 1:
 digitalWrite(led_e4, LOW); // sets the proper LED on, all else off
 digitalWrite(led_b3, LOW);
 digitalWrite(led_g3, LOW);
 digitalWrite(led_d3, LOW);
 digitalWrite(led_a2, HIGH);
 digitalWrite(led_e2, LOW);
 a = 0.0592;
 b = 0.8816;
 threshold = 150;
 upper_bound = 88;
 lower_bound = 44;
 avg_upper = 67;
 in_tune = 65; // This is the “in tune” average of cross counts for the string.
 avg_lower = 63;
 timer_divide = 2000;
 divide_by = 3;
 break;
 case 2:
 digitalWrite(led_e4, LOW); // sets the proper LED on, all else off
 digitalWrite(led_b3, LOW);
 digitalWrite(led_g3, LOW);
 digitalWrite(led_d3, HIGH);
 digitalWrite(led_a2, LOW);
 digitalWrite(led_e2, LOW);
 a = 0.0797;
 b = 0.8406;
 threshold = 150;
 upper_bound = 117;
 lower_bound = 63;
 avg_upper = 97;
 in_tune = 95; // This is the “in tune” average of cross counts for the string.
 avg_lower = 93;
 timer_divide = 2000;
 divide_by = 3;
 break;

I have to divede the code two parts because I cant put here all- the next is ather part of the code-
see the circuit image