I want to try out this library: https://github.com/connornishijima/arduino-volume3
I downloaded the zip file from github, renamed it, and included it as a library in the IDE.
So run one of the examples, A4_440HZ
This is its code:
#include "Volume3.h"
#define speakerPin 9
uint16_t frequency = 440;
void setup() {
// Nothing neeeded here!
}
void loop() {
for(uint16_t volume = 0; volume < 1023; volume++){
vol.tone(speakerPin,frequency,volume);
delay(1);
}
for(uint16_t volume = 1023; volume > 0; volume--){
vol.tone(speakerPin,frequency,volume);
delay(1);
}
}
And i get this error:
Error Compiling
A4_440Hz.cpp.o: In function `loop':
/usr/share/arduino/A4_440Hz.ino:12: undefined reference to `vol'
/usr/share/arduino/A4_440Hz.ino:12: undefined reference to `vol'
/usr/share/arduino/A4_440Hz.ino:16: undefined reference to `vol'
/usr/share/arduino/A4_440Hz.ino:16: undefined reference to `vol'
collect2: error: ld returned 1 exit status
I have no idea what is to blame, or how to mitigate it.
This is the first time that an included example from a library does not play out of the box.
extern Volume vol;
in header file, but there is no definition in cpp, nor in the sketch. TheVolume vol;
will be needed in your code, I suppose