Hello guys I got my Arduino 2 days ago and I'm fairly new to programming as well (I just know very basic stuff). I'm yet trying to get distance from my HC-SR04 Ultrasonic Distance Sensor and play a C4 (Do) note from a piezo at the same time. I tried to combine from 2 working codes, which then I want to turn into a musical instrument kinda thing, but I haven't been able to compile it successfully.
I have both included .h files in my library and they work fine with other codes.
This is the error:
Arduino: 1.8.2 (Windows 10), Board: "Arduino/Genuino Uno"
Tone.cpp.o (symbol from plugin): In function `timer0_pin_port':
(.text+0x0): multiple definition of `__vector_7'
libraries\NewPing\NewPing.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino/Genuino Uno.
I would try to find another library to use instead of NewPing - timer conflicts are common enough that you can usually find versions of the library with different timers. Sometimes the library itself has #defines in it that you can change to make it use different timers.
DrAzzy:
I would try to find another library to use instead of NewPing - timer conflicts are common enough that you can usually find versions of the library with different timers. Sometimes the library itself has #defines in it that you can change to make it use different timers.
Thank you so much. I used NewTone instead of tone and it works fine now. +1