Merhaba;
Vermiş olduğunuz cevap için teşekkür ederim ama ben konuyu tam olarak anlayamadım. Şimdi ben şu iki sensöre ait kodları birleştirmem gerekiyor;
1- ) sharp 2Y0A710K0F kızılötesi sensör;
const int signalPin= 0; //yellow wire connects to analog pin A0
const int LEDPin= 12; //LED connects to digital pin 13
int signal;//this variable, signal, will hold the analog value read by the arduino
void setup() {
Serial.begin(9600); //sets the baud rate for data transfer in bits/second
pinMode(signalPin, INPUT); //the infrared sensor signal line will be an input to the arduino
pinMode(LEDPin, OUTPUT); //the LED serves an output in the circuit
}
void loop() {
signal= analogRead(signalPin); //arduino reads the value from the infrared sensor
Serial.println(signal); //prints out analog value
delay(500); //delays the next analog reading by 500 ms or a half a second
if(signal < 500){ //if the analog value is less than 200, the object is within a few inches
digitalWrite(LEDPin, HIGH);
delay (3000);
digitalWrite (LEDPin, LOW);
delay(1000);
}
else{
digitalWrite(LEDPin, LOW);
}
}
2-) Ses sensörüne ait kod;
const int LEDPin = 12;
const int Sensor = 1;
int seviye;
const int esik = 550;
void setup()
{
pinMode (LEDPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
seviye = analogRead(Sensor);
if (seviye > esik)
{
digitalWrite (LEDPin, HIGH);
delay (3000);
digitalWrite (LEDPin, LOW);
delay(1000);
}
else
{
digitalWrite(LEDPin, LOW);
}
}
Yardımcı olursanız çok sevinirim.