Page 1 of 1

Sound Library error

PostPosted: Sat Jul 25, 2015 1:23 pm
by agentavacado
Hello, I have researched the "Programming Questions" section of the four for any "Error compiling." errors and could find none. It seems that there is an error with the following code(copied right from the reference area):
Code: Select all
#include <SPI.h>
#include <Gamebuino.h>
Gamebuino gb;

static unsigned const char PROGMEM logo[]=
{
  8,8,
  B00000000,
  B00100100,
  B00011000,
  B01111110,
  B00111100,
  B01111110,
  B00111100,
  B00000000,
};

void setup(){
  // initialize the Gamebuino object
  gb.begin();
  gb.titleScreen(F("Example game"), logo);
}

void loop(){
  if(gb.update()){
    gb.display.println("Hello world");
    if(gb.buttons.pressed(BTN_C)){
      gb.titleScreen(F("Example game"), logo);
    }
  }
}

The reason i'm posting this on the gamebuino forums and NOT the arduino forums is because it seems that there is a problem with the Sound part of the gamebuino library.
Code: Select all
/Users/_/Documents/Arduino/libraries/Gamebuino/Sound.cpp: In member function 'void Sound::begin()':
/Users/_/Documents/Arduino/libraries/Gamebuino/Sound.cpp:62:2: error: 'TCCR2B' was not declared in this scope
  TCCR2B = (TCCR2B & B11111000) | 1; //set timer 2 prescaler to 1 -> 30kHz PWM on pin 3
  ^
/Users/_/Documents/Arduino/libraries/Gamebuino/Sound.cpp: In static member function 'static void Sound::updateOutput()':
/Users/_/Documents/Arduino/libraries/Gamebuino/Sound.cpp:563:2: error: 'OCR2B' was not declared in this scope
  OCR2B = output; //60x faster than analogOutput() !
  ^
Error compiling.

Did I skip a step?

Re: Sound Library error

PostPosted: Sat Jul 25, 2015 3:20 pm
by rodot
Did you select Gamebuino in tools/board ? What version of Arduino are you running, on which operating system ?