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);
}
}