Great work!
I am new to the Arduino environment, but have some programming experience. I cannot get this sketch to compile. I continue to get the errors listed below. I’m not too sure how to decipher. I have copied this sketch from different sources only to get the same errors.
Any help would be most appreciated…
************* Copied Error listing ***********
Arduino: 1.8.9 (Windows 10), Board: “Arduino Nano, ATmega328P (Old Bootloader)”
Build options changed, rebuilding all
C:\Users\JTR\Documents\Arduino\My Sketches\CreeLightbulbNotify\CreeLightbulbNotify.ino:49:1: warning: narrowing conversion of ‘3.5e+0’ from ‘double’ to ‘int’ inside { } [-Wnarrowing]
};
^
C:\Users\JTR\Documents\Arduino\My Sketches\CreeLightbulbNotify\CreeLightbulbNotify.ino: In function ‘loop’:
C:\Users\JTR\Documents\Arduino\My Sketches\CreeLightbulbNotify\CreeLightbulbNotify.ino:78:54: warning: iteration 7 invokes undefined behavior [-Waggressive-loop-optimizations]
int noteDuration = 10000 / noteDurations[thisNote];
^
C:\Users\JTR\Documents\Arduino\My Sketches\CreeLightbulbNotify\CreeLightbulbNotify.ino:73:37: note: containing loop
for (int thisNote = 0; thisNote < 8; thisNote++) {
^
Tone.cpp.o (symbol from plugin): In function `timer0_pin_port’:
(.text+0x0): multiple definition of `timer0_pin_port’
libraries\Tone-master\Tone.cpp.o (symbol from plugin):(.text+0x0): first defined here
Tone.cpp.o (symbol from plugin): In function `timer0_pin_port’:
(.text+0x0): multiple definition of `timer0_pin_mask’
libraries\Tone-master\Tone.cpp.o (symbol from plugin):(.text+0x0): first defined here
Tone.cpp.o (symbol from plugin): In function `timer0_pin_port’:
(.text+0x0): multiple definition of `timer1_pin_port’
libraries\Tone-master\Tone.cpp.o (symbol from plugin):(.text+0x0): first defined here
Tone.cpp.o (symbol from plugin): In function `timer0_pin_port’:
(.text+0x0): multiple definition of `timer1_pin_mask’
libraries\Tone-master\Tone.cpp.o (symbol from plugin):(.text+0x0): first defined here
Tone.cpp.o (symbol from plugin): In function `timer0_pin_port’:
(.text+0x0): multiple definition of `timer2_pin_port’
libraries\Tone-master\Tone.cpp.o (symbol from plugin):(.text+0x0): first defined here
Tone.cpp.o (symbol from plugin): In function `timer0_pin_port’:
(.text+0x0): multiple definition of `timer2_pin_mask’
libraries\Tone-master\Tone.cpp.o (symbol from plugin):(.text+0x0): first defined here
Tone.cpp.o (symbol from plugin): In function `timer0_pin_port’:
(.text+0x0): multiple definition of `timer0_toggle_count’
libraries\Tone-master\Tone.cpp.o (symbol from plugin):(.text+0x0): first defined here
Tone.cpp.o (symbol from plugin): In function `timer0_pin_port’:
(.text+0x0): multiple definition of `timer1_toggle_count’
libraries\Tone-master\Tone.cpp.o (symbol from plugin):(.text+0x0): first defined here
Tone.cpp.o (symbol from plugin): In function `timer0_pin_port’:
(.text+0x0): multiple definition of `timer2_toggle_count’
libraries\Tone-master\Tone.cpp.o (symbol from plugin):(.text+0x0): first defined here
Tone.cpp.o (symbol from plugin): In function `timer0_pin_port’:
(.text+0x0): multiple definition of `__vector_7’
libraries\Tone-master\Tone.cpp.o (symbol from plugin):(.text+0x0): first defined here
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\main.cpp: In function ‘main’:
C:\Users\JTR\Documents\Arduino\My Sketches\CreeLightbulbNotify\CreeLightbulbNotify.ino:78:54: warning: iteration 7 invokes undefined behavior [-Waggressive-loop-optimizations]
int noteDuration = 10000 / noteDurations[thisNote];
^
C:\Users\JTR\Documents\Arduino\My Sketches\CreeLightbulbNotify\CreeLightbulbNotify.ino:73:37: note: containing loop
for (int thisNote = 0; thisNote < 8; thisNote++) {
^
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino Nano.
This report would have more information with
“Show verbose output during compilation”
option enabled in File -> Preferences.