This is my first time writing on this forum so I may not have chosen the right place but nevermind.
I am using an HC-SR 501 an a simple buzzer so as to when the PIR sensor detects movement the buzzer sounds.
I am using a NodeMCU 1.0 module and here is my code (some clarifications are in Catalan but just ignore them) and also excuse me for my English, I'm quite young.
As I was saying, here's the code:
int PIRpin = D1; // PIR connectat, declarem en quina entrada digital està connectat.
int value; //Creem la variable value per a guardar el valor.
int buzzer = D2;
void setup() {
Serial.begin(9600);
}
void loop() {
value = digitalRead(PIRpin); //Llegeix l'estat del PIR
if (value == LOW) {
Serial.println("SEGUR");
digitalWrite (D1, LOW);
noTone(buzzer, 1000); //Fem sonar el brunzidor
}
else {
Serial.println("ALERTA, INTRÚS!");
digitalWrite (D1, HIGH);
tone(buzzer, 1000);
}
delay(250); //Espera
}
when I compile it I get this error:
Arduino:1.8.5 (Windows 10), Tarjeta:"NodeMCU 1.0 (ESP-12E Module), 80 MHz, 4M (1M SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200"
C:\Users\arg21\Desktop\TR\PIR\PIR.ino: In function 'void loop()':
PIR:15: error: too many arguments to function 'void noTone(uint8_t)'
noTone(buzzer, 1000);
^
In file included from sketch\PIR.ino.cpp:1:0:
C:\Users\arg21\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\cores\esp8266/Arduino.h:282:6: note: declared here
void noTone(uint8_t _pin);
^
exit status 1
too many arguments to function 'void noTone(uint8_t)'
I need some help to carry on thanks in advance.