hfjfgi / rogue-code

Automatically exported from code.google.com/p/rogue-code
0 stars 0 forks source link

Tone Library fails to comply for the Leonardo #13

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. include tone library on a Arduino leonardo board.
2. #include <Tone.h>
3.

What is the expected output? What do you see instead?
A proper compile is expected. Instead there is an error compiling.

/Users/Alexander/Documents/Arduino/libraries/Tone/Tone.cpp: In member function 
'void Tone::begin(uint8_t)':
/Users/Alexander/Documents/Arduino/libraries/Tone/Tone.cpp:149: error: 'TCCR2A' 
was not declared in this scope
/Users/Alexander/Documents/Arduino/libraries/Tone/Tone.cpp:150: error: 'TCCR2B' 
was not declared in this scope
/Users/Alexander/Documents/Arduino/libraries/Tone/Tone.cpp:151: error: 'WGM21' 
was not declared in this scope
/Users/Alexander/Documents/Arduino/libraries/Tone/Tone.cpp:152: error: 'CS20' 
was not declared in this scope
/Users/Alexander/Documents/Arduino/libraries/Tone/Tone.cpp: In member function 
'void Tone::play(uint16_t, uint32_t)':
/Users/Alexander/Documents/Arduino/libraries/Tone/Tone.cpp:256: error: 'TCCR2B' 
was not declared in this scope
/Users/Alexander/Documents/Arduino/libraries/Tone/Tone.cpp:314: error: 'OCR2A' 
was not declared in this scope

What version of the product are you using? On what operating system?
Arduino 1.0.3 with a Arduino Leonardo on Mac OSX 10.8.3

Please provide any additional information below.

I have added "#include <Arduino.h>"  to the Tone.ccp file.

Original issue reported on code.google.com by nmc.arus...@gmail.com on 24 Apr 2013 at 7:18

GoogleCodeExporter commented 8 years ago
I'm getting the same errors on Mac 10.6 after trying the suggestions in the 
following thread to fix the original errors: 
http://forum.arduino.cc/index.php?topic=87398.0

Original comment by elliot.m...@gmail.com on 15 May 2013 at 5:26

GoogleCodeExporter commented 8 years ago
the same is happening for me!
compiling on arduino uno is no problem.

i am pretty sure that it has to do sth. with the ifdef scope:

#if defined(__AVR_ATmega8__)
#define TCCR2A TCCR2
#define TCCR2B TCCR2
#define COM2A1 COM21
#define COM2A0 COM20
#define OCR2A OCR2
#define TIMSK2 TIMSK
#define OCIE2A OCIE2
#define TIMER2_COMPA_vect TIMER2_COMP_vect
#define TIMSK1 TIMSK
#endif

the leonardo is a __AVR_ATmega32U4__ and there is no entry for this type in the 
tone.cpp

anyone news on this issue ?

Original comment by cpietsch on 9 Jun 2013 at 4:45

GoogleCodeExporter commented 8 years ago
guys, to solve the problem we have to add #include <Arduino.h> to the Tone.ccp

Original comment by juanba...@gmail.com on 12 Jun 2013 at 11:41

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
we have added "#include <Arduino.h>", see the last line of the bug report.

Original comment by cpietsch on 13 Jun 2013 at 5:33

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi guys,

I've amended the tone.cpp file for compatibility with ATmegaA32U4 boards (e.g. 
Leonardo) and Arduino IDE 1.00 onwards.

Just replace this in the library and it should work. It worked for my Leonardo! 
:)

Kwok Leong

Original comment by kwokleon...@gmail.com on 8 Aug 2013 at 6:26

Attachments:

GoogleCodeExporter commented 8 years ago
for arduino leonardo interrupts is : TCCR0A,TCCR0B,OCR0A,TIMSK0 :) GOOD LUCK

Original comment by andrei.g...@gmail.com on 2 Jul 2014 at 11:24

GoogleCodeExporter commented 8 years ago
"for arduino leonardo interrupts is : TCCR0A,TCCR0B,OCR0A,TIMSK0 :) GOOD LUCK"

thanks!

Original comment by zoran...@gmail.com on 15 Dec 2014 at 12:35