Sound Library error

Understanding the language, error messages, etc.

Sound Library error

Postby agentavacado » Sat Jul 25, 2015 1:23 pm

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?
agentavacado
 
Posts: 19
Joined: Thu Jun 25, 2015 12:50 am

Re: Sound Library error

Postby rodot » Sat Jul 25, 2015 3:20 pm

Did you select Gamebuino in tools/board ? What version of Arduino are you running, on which operating system ?
User avatar
rodot
Site Admin
 
Posts: 1290
Joined: Mon Nov 19, 2012 11:54 pm
Location: France


Return to Programming Questions

Who is online

Users browsing this forum: No registered users and 77 guests