Archive of the Gamebuino Classic forum (2014-2018), rebuilt from the pages kept by the Wayback Machine: only part of the topics and pages were captured. Read-only. Removal on request: hi@gamebuino.com.
Gamebuino sound output
cyberic Mon May 18, 2015 8:48 am
Hello!
I'd like to know which pin is used for sound output.
Is this documented somewhere?
And another question:
Does Gamebuino library use Timer1 and Timer2?
I'd like to use a library that use them as well, so is there a risk of confilct?
Thanks
Eric
I'd like to know which pin is used for sound output.
Is this documented somewhere?
And another question:
Does Gamebuino library use Timer1 and Timer2?
I'd like to use a library that use them as well, so is there a risk of confilct?
Thanks
Eric
Sorunome Mon May 18, 2015 11:36 am
As far as I know the gamebuino library uses all of Timer1 through Timer4 for various things, including sounds and other.
You can find the schematics of the gamebuino here: http://gamebuino.com/wiki/index.php?title=Hardware
You can find the schematics of the gamebuino here: http://gamebuino.com/wiki/index.php?title=Hardware
cyberic Mon May 18, 2015 12:01 pm
Sorunome wrote:You can find the schematics of the gamebuino here: http://gamebuino.com/wiki/index.php?title=Hardware
Ha yes sorry I overlooked the document.
Sorunome wrote:As far as I know the gamebuino library uses all of Timer1 through Timer4 for various things, including sounds and other.
Thanks
Is it documented somewhere or should I look at the source code?
Sorunome Mon May 18, 2015 1:57 pm
cyberic wrote:Sorunome wrote:You can find the schematics of the gamebuino here: http://gamebuino.com/wiki/index.php?title=Hardware
Ha yes sorry I overlooked the document.Sorunome wrote:As far as I know the gamebuino library uses all of Timer1 through Timer4 for various things, including sounds and other.
Thanks
Is it documented somewhere or should I look at the source code?
I am not sure about this, but you'll probably find answers in the gamebuino library source.
rodot Thu May 28, 2015 5:34 pm
The buzzer is connected to the pin PD3/INT1/OC2B/PCINT19 of the Atmega328, which is the Arduino pin 3 (pwm).
All the atmega328 timers are used by both Arduino and the Gamebuino library:
Timer 0 is for Arduino functions like delay(), millis() and micros(), which are used by the Gamebuino library for timing (framerate regulation and alike).
Timer 1 is used to generate interruptions to update the sound waveform at about 57Khz (it might seem high but it's to manage accurate sound frequency and not to be off-tune)
Timer 2 is used to generate 30Khz PWM output to the pin 3 as a DAC of sound generation
More info about arduino, timers and interruptions : http://letsmakerobots.com/content/arduino-101-timers-and-interrupts
If you disable the sound engine by changing
to
in the file settings.c in the Gamebuino library folder, you should be able to use libraries that require timer 1 or 2.
You're not asking for it, but some people might be interested by the Sound page of the wiki which explains how the sound library works (but there is no composer yet...)
All the atmega328 timers are used by both Arduino and the Gamebuino library:
Timer 0 is for Arduino functions like delay(), millis() and micros(), which are used by the Gamebuino library for timing (framerate regulation and alike).
Timer 1 is used to generate interruptions to update the sound waveform at about 57Khz (it might seem high but it's to manage accurate sound frequency and not to be off-tune)
Timer 2 is used to generate 30Khz PWM output to the pin 3 as a DAC of sound generation
More info about arduino, timers and interruptions : http://letsmakerobots.com/content/arduino-101-timers-and-interrupts
If you disable the sound engine by changing
- Code: Select all
#define NUM_CHANNELS 1
to
- Code: Select all
#define NUM_CHANNELS 0
in the file settings.c in the Gamebuino library folder, you should be able to use libraries that require timer 1 or 2.
You're not asking for it, but some people might be interested by the Sound page of the wiki which explains how the sound library works (but there is no composer yet...)