Problem Guitar pedal fo effects with arduino

Good evening to all!
I need help urgently.

I'm trying to make with arduino an effect pedal for an electric guitar and I'm facing some problems. I'm a sound engineer so I'm trying to follow the signal flow by the sound. With the help of chat gpt I am making the code and facing some problems. I bought an arduino but I don't know if it's a fake (arduino uno r3 (compatible)). I've kept the code as simple as possible to see if a signal goes through and doesn't come out, or if it's going to be very noisy, or if it's going to be very low and noisy. I have additionally built a signal amplifier on the breadboard that has an input to the analog output of the arduino but it didn't work because it was amplified and the noise and the audio signal was very bad. I need help with both the circuit and the code.

const int inputPin = 2;   // Ψηφιακή είσοδος
const int outputPin = A2; // Αναλογική έξοδος
const int ledPin = 4;     // Έξοδος για το LED

int filteredValue = 0;    // Αρχική τιμή του φιλτραρισμένου σήματος

void setup() {
  pinMode(inputPin, INPUT);
  pinMode(outputPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
}

void loop() {
  // Διάβασμα της τιμής από την ψηφιακή είσοδο
  int sensorValue = digitalRead(inputPin) * 1023; // Μετατροπή της τιμής σε αντίστοιχη αναλογική τιμή (0 ή 1023)
  
  // Φιλτράρισμα της τιμής με ένα απλό φίλτρο χαμηλής περάτωσης
  filteredValue = (sensorValue + 4 * filteredValue) / 5; // Το 4/5 είναι ένας απλός τρόπος να κάνουμε το φιλτράρισμα
  
  // Εξαγωγή της τιμής στην αναλογική έξοδο
  analogWrite(outputPin, filteredValue);
  
  // Έλεγχος για την αναγνώριση εισόδου και ανάβειμα του LED
  if (sensorValue > 0) {
    digitalWrite(ledPin, HIGH);
  } else {
    digitalWrite(ledPin, LOW);
  }
}

Uploading: 20240513_175805.jpg…

On an arduino uno r3 there is no real analog output. This line

create a PWM signal

also your filteredValue is an int, so you are doing integer based math, not floating point. This might impact your smoothing

Looks like you hit the return key before that file had finished loading, so we can't see what hopefully is your schematic.

The analogue input pins will not produce PWM like you are expecting. Only those pins with a ~ next to them are capable of PWM.
For a Uno these are 3, 5, 6, 9,10 and 11

You also need to increase the PWM speed on these pins to about 100KHz or above.

ah - I forgot to check which pin that was...

According to this quote

I had assumed that @lefteris_m expected a true analog Signal out (ie something stable between 0 and 5V)

Hi, @lefteris_m.