16-01-2019, 04:03 PM
Hola me llamo Aimar ya hace un tiempo que estoy con el tema de Arduino y ahora me ha salido un error que no se cual es. Me podríais ayudar? Tengo una arduino Uno y estoy intentando hacer un circuito en el que cuando la distancia detectada por el sensor ultrasonico sea inferior a 20cm entonces un buzzer empiece a sonar, pero me sale este error:
Arduino:1.8.7 (Windows 8.1), Tarjeta:"Arduino/Genuino Uno"
Tone.cpp.o (symbol from plugin): In function `timer0_pin_port':
(.text+0x0): multiple definition of `__vector_7'
libraries\arduino_164897\NewPing.cpp.o (symbol from plugin).text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compilando para la tarjeta Arduino/Genuino Uno.
}
Ya no se que hacer estoy bloqueado, he probado casi todo , reiniciar el ordenador, cambiar de buzzer y sensor ultrasonico ... He pensado que podria ser el codigo pero no creo asi aqui esta:
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.
void setup() {
Serial.begin(9600); // Open serial monitor at 115200 baud to see ping results.
}
void loop() {
delay(500); // Wait 500ms between pings (about 2 pings/sec). 29ms should be the shortest delay between pings.
unsigned int uS = sonar.ping(); // Send ping, get ping time in microseconds (uS).
Serial.print("Ping: ");
Serial.print(uS / US_ROUNDTRIP_CM); // Convert ping time to distance and print result (0 = outside set distance range, no ping echo)
Serial.println("cm");
if (uS / US_ROUNDTRIP_CM < 20)
{
tone(5, 60, 1);
tone(5, 20, 1);
}
}
Por favor enviadme una respuesta rapido , no se que hacer estoy desesperado!
Arduino:1.8.7 (Windows 8.1), Tarjeta:"Arduino/Genuino Uno"
Tone.cpp.o (symbol from plugin): In function `timer0_pin_port':
(.text+0x0): multiple definition of `__vector_7'
libraries\arduino_164897\NewPing.cpp.o (symbol from plugin).text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compilando para la tarjeta Arduino/Genuino Uno.
}
Ya no se que hacer estoy bloqueado, he probado casi todo , reiniciar el ordenador, cambiar de buzzer y sensor ultrasonico ... He pensado que podria ser el codigo pero no creo asi aqui esta:
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.
void setup() {
Serial.begin(9600); // Open serial monitor at 115200 baud to see ping results.
}
void loop() {
delay(500); // Wait 500ms between pings (about 2 pings/sec). 29ms should be the shortest delay between pings.
unsigned int uS = sonar.ping(); // Send ping, get ping time in microseconds (uS).
Serial.print("Ping: ");
Serial.print(uS / US_ROUNDTRIP_CM); // Convert ping time to distance and print result (0 = outside set distance range, no ping echo)
Serial.println("cm");
if (uS / US_ROUNDTRIP_CM < 20)
{
tone(5, 60, 1);
tone(5, 20, 1);
}
}
Por favor enviadme una respuesta rapido , no se que hacer estoy desesperado!