TMRh20 / TMRpcm

Arduino library for asynchronous playback of PCM/WAV files direct from SD card. Arduino Uno,Nano,Mega etc supported
http://tmrh20.blogspot.com
597 stars 178 forks source link

Error compiling for board Arduino Micro. #194

Closed ArduinoFan0 closed 1 year ago

ArduinoFan0 commented 1 year ago

Servo on pin 10, speaker on pin 9, Distance sensor Trigger and Echo on pins 7 and 8, and SD card Chip select on pin 5. comments from pcmConfig.h have been uncommented: `#define USE_TIMER2

define DISABLE_SPEAKER2`

Here is the full error: `In file included from C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master/TMRpcm.h:14:0, from C:\Users\smart\OneDrive\Documents\Arduino\music\music.ino:4: C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master/pcmConfig.h:48:4: warning: "/" within comment [-Wcomment] / Use the SDFAT library from http://code.google.com/p/sdfatlib/ */

C:\Users\smart\OneDrive\Documents\Arduino\music\music.ino: In function 'void loop()': C:\Users\smart\OneDrive\Documents\Arduino\music\music.ino:48:38: warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings] case 'd': tmrpcm.play("music.wav"); break; ^ C:\Users\smart\OneDrive\Documents\Arduino\music\music.ino:49:39: warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings] case 'P': tmrpcm.play("temple.wav"); break; ^ C:\Users\smart\OneDrive\Documents\Arduino\music\music.ino:50:40: warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings] case 't': tmrpcm.play("catfish.wav"); break; ^ C:\Users\smart\OneDrive\Documents\Arduino\music\music.ino:62:28: warning: ISO C++ forbids converting a string constant to 'char' [-Wwrite-strings] tmrpcm.play("catfish.wav"); ^ C:\Users\smart\OneDrive\Documents\Arduino\music\music.ino: In function 'long int ping()': C:\Users\smart\OneDrive\Documents\Arduino\music\music.ino:97:24: warning: variable 'inches' set but not used [-Wunused-but-set-variable] long duration, inches, cm; ^~ C:\Users\smart\OneDrive\Documents\Arduino\music\music.ino:130:8: warning: unused variable 'avgCm' [-Wunused-variable] long avgCm = list[0] + list[1] + list[2] + list[3] + list[4] + list[5] + list[6] + list[7] + list[8] + list[9] / 10; ^~~~~ C:\Users\smart\OneDrive\Documents\Arduino\music\music.ino:130:22: warning: 'list[0]' is used uninitialized in this function [-Wuninitialized] long avgCm = list[0] + list[1] + list[2] + list[3] + list[4] + list[5] + list[6] + list[7] + list[8] + list[9] / 10;


C:\Users\smart\OneDrive\Documents\Arduino\music\music.ino:130:32: warning: 'list[1]' is used uninitialized in this function [-Wuninitialized]
   long avgCm = list[0] + list[1] + list[2] + list[3] + list[4] + list[5] + list[6] + list[7] + list[8] + list[9] / 10;
                          ~~~~~~^
C:\Users\smart\OneDrive\Documents\Arduino\music\music.ino:130:42: warning: 'list[2]' is used uninitialized in this function [-Wuninitialized]
   long avgCm = list[0] + list[1] + list[2] + list[3] + list[4] + list[5] + list[6] + list[7] + list[8] + list[9] / 10;
                                    ~~~~~~^
C:\Users\smart\OneDrive\Documents\Arduino\music\music.ino:130:52: warning: 'list[3]' is used uninitialized in this function [-Wuninitialized]
   long avgCm = list[0] + list[1] + list[2] + list[3] + list[4] + list[5] + list[6] + list[7] + list[8] + list[9] / 10;
                                              ~~~~~~^
C:\Users\smart\OneDrive\Documents\Arduino\music\music.ino:130:62: warning: 'list[4]' is used uninitialized in this function [-Wuninitialized]
   long avgCm = list[0] + list[1] + list[2] + list[3] + list[4] + list[5] + list[6] + list[7] + list[8] + list[9] / 10;
                                                        ~~~~~~^
C:\Users\smart\OneDrive\Documents\Arduino\music\music.ino:130:72: warning: 'list[5]' is used uninitialized in this function [-Wuninitialized]
   long avgCm = list[0] + list[1] + list[2] + list[3] + list[4] + list[5] + list[6] + list[7] + list[8] + list[9] / 10;
                                                                  ~~~~~~^
C:\Users\smart\OneDrive\Documents\Arduino\music\music.ino:130:82: warning: 'list[6]' is used uninitialized in this function [-Wuninitialized]
   long avgCm = list[0] + list[1] + list[2] + list[3] + list[4] + list[5] + list[6] + list[7] + list[8] + list[9] / 10;
                                                                            ~~~~~~^
C:\Users\smart\OneDrive\Documents\Arduino\music\music.ino:130:92: warning: 'list[7]' is used uninitialized in this function [-Wuninitialized]
   long avgCm = list[0] + list[1] + list[2] + list[3] + list[4] + list[5] + list[6] + list[7] + list[8] + list[9] / 10;
                                                                                      ~~~~~~^
C:\Users\smart\OneDrive\Documents\Arduino\music\music.ino:130:102: warning: 'list[8]' is used uninitialized in this function [-Wuninitialized]
   long avgCm = list[0] + list[1] + list[2] + list[3] + list[4] + list[5] + list[6] + list[7] + list[8] + list[9] / 10;
                                                                                                ~~~~~~^
C:\Users\smart\OneDrive\Documents\Arduino\music\music.ino:130:112: warning: 'list[9]' is used uninitialized in this function [-Wuninitialized]
   long avgCm = list[0] + list[1] + list[2] + list[3] + list[4] + list[5] + list[6] + list[7] + list[8] + list[9] / 10;
                                                                                                          ~~~~~~^
In file included from C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:5:0:
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master/pcmConfig.h:48:4: warning: "/*" within comment [-Wcomment]
    /* Use the SDFAT library from http://code.google.com/p/sdfatlib/            */

In file included from C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master/TMRpcm.h:14:0,
                 from C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master/pcmRF.h:6,
                 from C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\pcmRF.cpp:2:
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master/pcmConfig.h:48:4: warning: "/*" within comment [-Wcomment]
    /* Use the SDFAT library from http://code.google.com/p/sdfatlib/            */

C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:138:36: error: 'TIMSK2' was not declared in this scope
         volatile byte *TIMSK[] = {&TIMSK2};
                                    ^~~~~~
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:138:36: note: suggested alternative: 'TIMSK'
         volatile byte *TIMSK[] = {&TIMSK2};
                                    ^~~~~~
                                    TIMSK
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:139:37: error: 'TCCR2A' was not declared in this scope
         volatile byte *TCCRnA[] = {&TCCR2A};
                                     ^~~~~~
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:139:37: note: suggested alternative: 'TCCRnA'
         volatile byte *TCCRnA[] = {&TCCR2A};
                                     ^~~~~~
                                     TCCRnA
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:140:37: error: 'TCCR2B' was not declared in this scope
         volatile byte *TCCRnB[] = {&TCCR2B};
                                     ^~~~~~
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:140:37: note: suggested alternative: 'TCCRnB'
         volatile byte *TCCRnB[] = {&TCCR2B};
                                     ^~~~~~
                                     TCCRnB
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:141:36: error: 'OCR2A' was not declared in this scope
         volatile byte *OCRnA[] = {&OCR2A};
                                    ^~~~~
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:141:36: note: suggested alternative: 'OCRnA'
         volatile byte *OCRnA[] = {&OCR2A};
                                    ^~~~~
                                    OCRnA
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:142:36: error: 'OCR2B' was not declared in this scope
         volatile byte *OCRnB[] = {&OCR2B};
                                    ^~~~~
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:142:36: note: suggested alternative: 'OCRnB'
         volatile byte *OCRnB[] = {&OCR2B};
                                    ^~~~~
                                    OCRnB
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:143:35: error: 'TCNT2' was not declared in this scope
         volatile byte *TCNT[] = {&TCNT2};
                                   ^~~~~
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:143:35: note: suggested alternative: 'TCNT'
         volatile byte *TCNT[] = {&TCNT2};
                                   ^~~~~
                                   TCNT
In file included from c:\program files\windowsapps\arduinollc.arduinoide_1.8.57.0_x86__mdqgnx93n4wtt\hardware\tools\avr\avr\include\avr\io.h:99:0,
                 from c:\program files\windowsapps\arduinollc.arduinoide_1.8.57.0_x86__mdqgnx93n4wtt\hardware\tools\avr\avr\include\avr\pgmspace.h:90,
                 from C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:28,
                 from C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master/pcmConfig.h:20,
                 from C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:5:
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:145:34: error: 'OCIE2B' was not declared in this scope
         const byte togByte = _BV(OCIE2B);
                                  ^
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:145:34: note: suggested alternative: 'OCIE0B'
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp: In member function 'void TMRpcm::timerSt()':
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:226:23: error: 'WGM21' was not declared in this scope
     *TCCRnA[tt] = _BV(WGM21) | _BV(WGM20) | _BV(COM2B1); //Fast PWM with 0xFF (255) top
                       ^
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:226:23: note: suggested alternative: 'WGM41'
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:226:36: error: 'WGM20' was not declared in this scope
     *TCCRnA[tt] = _BV(WGM21) | _BV(WGM20) | _BV(COM2B1); //Fast PWM with 0xFF (255) top
                                    ^
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:226:36: note: suggested alternative: 'WGM40'
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:226:49: error: 'COM2B1' was not declared in this scope
     *TCCRnA[tt] = _BV(WGM21) | _BV(WGM20) | _BV(COM2B1); //Fast PWM with 0xFF (255) top
                                                 ^
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:226:49: note: suggested alternative: 'COM1B1'
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp: In member function 'void TMRpcm::pause()':
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:401:33: error: 'OCIE2B' was not declared in this scope
             *TIMSK[tt] |= ( _BV(OCIE2B) | _BV(TOIE1) );
                                 ^
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:401:33: note: suggested alternative: 'OCIE0B'
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp: In member function 'void TMRpcm::play(char*, long unsigned int)':
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:511:29: error: 'CS20' was not declared in this scope
         *TCCRnB[tt] &= ~_BV(CS20);
                             ^
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:511:29: note: suggested alternative: 'CS00'
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:512:28: error: 'CS21' was not declared in this scope
         *TCCRnB[tt] |= _BV(CS21);
                            ^
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:512:28: note: suggested alternative: 'CS01'
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:514:29: error: 'CS21' was not declared in this scope
         *TCCRnB[tt] &= ~_BV(CS21);
                             ^
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:514:29: note: suggested alternative: 'CS01'
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:515:28: error: 'CS20' was not declared in this scope
         *TCCRnB[tt] |= _BV(CS20);
                            ^
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:515:28: note: suggested alternative: 'CS00'
In file included from C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:30:0,
                 from C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master/pcmConfig.h:20,
                 from C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:5:
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp: In function 'void TIMER2_COMPB_vect()':
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:593:5: warning: 'TIMER2_COMPB_vect' appears to be a misspelled 'signal' handler, missing '__vector' prefix [-Wmisspelled-isr]
 ISR(TIMER2_COMPB_vect){
     ^
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:609:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if( sFile.available() <= dataEnd){
             ~~~~~~~~~~~~~~~~~~^~~~~~~~~~
In file included from C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:30:0,
                 from C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master/pcmConfig.h:20,
                 from C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:5:
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp: In function 'void TIMER2_OVF_vect()':
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:631:9: warning: 'TIMER2_OVF_vect' appears to be a misspelled 'signal' handler, missing '__vector' prefix [-Wmisspelled-isr]
     ISR(TIMER2_OVF_vect){
         ^
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp: In member function 'void TMRpcm::disable()':
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:731:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i=0; i < resolution; i++){
                      ~~^~~~~~~~~~~~
In file included from C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master/pcmConfig.h:20:0,
                 from C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:5:
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:95:58: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
                                                     ~~~~~^~~~~~~
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:736:30: note: in expansion of macro 'constrain'
                 *OCRnB[tt] = constrain((current - i),0,resolution);
                              ^~~~~~~~~
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:95:58: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
                                                     ~~~~~^~~~~~~
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:737:30: note: in expansion of macro 'constrain'
                 *OCRnA[tt] = constrain((current - i),0,resolution);
                              ^~~~~~~~~
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp: In member function 'byte TMRpcm::metaInfo(boolean, char*, char*, byte)':
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:1409:24: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
         char* datStr = "LIST";
                        ^~~~~~
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:1410:36: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
         if(infoType == 1){datStr = "ID3 "; datStr[3] = 3;}
                                    ^~~~~~
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:1438:45: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
     char* tagNames[] = {"INAM","IART","IPRD"};
                                             ^
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:1438:45: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:1438:45: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:1458:27: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
             tagNames[0] = "TPE1"; tagNames[1] ="TIT2"; tagNames[2] ="TALB";
                           ^~~~~~
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:1458:48: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
             tagNames[0] = "TPE1"; tagNames[1] ="TIT2"; tagNames[2] ="TALB";
                                                ^~~~~~
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:1458:69: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
             tagNames[0] = "TPE1"; tagNames[1] ="TIT2"; tagNames[2] ="TALB";
                                                                     ^~~~~~
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp: In member function 'void TMRpcm::finalizeWavTemplate(char*)':
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:1601:68: warning: narrowing conversion of '(fSize >> 16)' from 'long unsigned int' to 'byte {aka unsigned char}' inside { } [-Wnarrowing]
     seek(4); byte data[4] = {lowByte(fSize),highByte(fSize), fSize >> 16,fSize >> 24};
                                                              ~~~~~~^~~~~
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:1601:80: warning: narrowing conversion of '(fSize >> 24)' from 'long unsigned int' to 'byte {aka unsigned char}' inside { } [-Wnarrowing]
     seek(4); byte data[4] = {lowByte(fSize),highByte(fSize), fSize >> 16,fSize >> 24};
                                                                          ~~~~~~^~~~~
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:1603:10: warning: unused variable 'tmp' [-Wunused-variable]
     byte tmp;
          ^~~
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp: In member function 'boolean TMRpcm::ifOpen()':
C:\Users\smart\OneDrive\Documents\Arduino\libraries\TMRpcm-master\TMRpcm.cpp:429:5: warning: control reaches end of non-void function [-Wreturn-type]
     }
     ^
exit status 1
Error compiling for board Arduino Micro.
`
TMRh20 commented 1 year ago

Unfortunately the Arduino Micro has no support for the Timer2 functionality. It only has a 10-bit and two 16-bit timers, no 8-bit timer like the 328 (Uno, Nano, etc).