Hi,
I'm trying to make a sound level monitor with an arduino uno, with the 433MHz RF Tx-Rx Modules sending input from a mic in one place to the arduino board and lighting the LED up.
But, if one of the mics at the ardunio side send a signal, then the LED that has the mic elsewhere lights up and doesn't turn off unless it gets a signal
I don't know how to fix it so some help would be appreciated (The code is below)
const int leftPin = 13;
const int rightPin = 12;
const int monoPin = 11;
const int onPin = 10;
const int leftsoundPin = 9;
const int rightsoundPin = 8;
const int monosoundPin = 7;
const int laserPin = 6;
int leftsoundVal = 0;
int rightsoundVal = 0;
int monosoundVal = 0;
void setup ()
{
pinMode (leftPin, OUTPUT);
pinMode (rightPin, OUTPUT);
pinMode (monoPin, OUTPUT);
pinMode (onPin, OUTPUT);
pinMode (leftsoundPin, INPUT);
pinMode (rightsoundPin, INPUT);
pinMode (monosoundPin, INPUT);
pinMode (laserPin, OUTPUT);
digitalWrite(laserPin, HIGH);
digitalWrite(onPin, HIGH);
delay(500);
digitalWrite(onPin, LOW);
delay(500);
digitalWrite(onPin, HIGH);
delay(500);
digitalWrite(onPin, LOW);
delay(500);
digitalWrite(onPin, HIGH);
delay(500);
}
void loop ()
{
leftsoundVal = digitalRead(leftsoundPin);
rightsoundVal = digitalRead(rightsoundPin);
monosoundVal = digitalRead(monosoundPin);
if (monosoundVal == HIGH)
{
digitalWrite(monoPin, HIGH);
}
else {
digitalWrite(monoPin, LOW);
}
if (leftsoundVal == HIGH)
{
digitalWrite(leftPin, LOW);
}
else {
digitalWrite(leftPin, HIGH);
}
if (rightsoundVal == HIGH)
{
digitalWrite(rightPin, LOW);
}
else {
digitalWrite(rightPin, HIGH);
}
}