Go Down

Topic: Problemas na compliação (Read 881 times) previous topic - next topic

Luigi_xp

Ola,sou novo aqui

estou tendo um problema na compliação, esta dando um erro: tone1 was not declared in this scope e secleciona Tone tone1; é para tocar o tema do mario no alto falante

Code: [Select]
Tone tone1;

void setup()
{
  tone1.begin(11);//Playback on Pin 11, change to whatever you may need
}

void loop()
{
tone1.play(660,100);
delay(75);tone1.play(660,100);
delay(150);tone1.play(660,100);
delay(150);tone1.play(510,100);
delay(50);tone1.play(660,100);
delay(150);tone1.play(770,100);
delay(275);tone1.play(380,100);
delay(287);tone1.play(510,100);
delay(225);tone1.play(380,100);
delay(200);tone1.play(320,100);
delay(250);tone1.play(440,100);
delay(150);tone1.play(480,80);
delay(165);tone1.play(450,100);
delay(75);tone1.play(430,100);
delay(150);tone1.play(380,100);
delay(100);tone1.play(660,80);
delay(100);tone1.play(760,50);
delay(75);tone1.play(860,100);
delay(150);tone1.play(700,80);
delay(75);tone1.play(760,50);
delay(175);tone1.play(660,80);
delay(150);tone1.play(520,80);
delay(75);tone1.play(580,80);
delay(75);tone1.play(480,80);
delay(175);tone1.play(510,100);
delay(275);tone1.play(380,100);
delay(200);tone1.play(320,100);
delay(250);tone1.play(440,100);
delay(150);tone1.play(480,80);
delay(165);tone1.play(450,100);
delay(75);tone1.play(430,100);
delay(150);tone1.play(380,100);
delay(100);tone1.play(660,80);
delay(100);tone1.play(760,50);
delay(75);tone1.play(860,100);
delay(150);tone1.play(700,80);
delay(75);tone1.play(760,50);
delay(175);tone1.play(660,80);
delay(150);tone1.play(520,80);
delay(75);tone1.play(580,80);
delay(75);tone1.play(480,80);
delay(250);tone1.play(500,100);
delay(150);tone1.play(760,100);
delay(50);tone1.play(720,100);
delay(75);tone1.play(680,100);
delay(75);tone1.play(620,150);
delay(150);tone1.play(650,150);
delay(150);tone1.play(380,100);
delay(75);tone1.play(430,100);
delay(75);tone1.play(500,100);
delay(150);tone1.play(430,100);
delay(75);tone1.play(500,100);
delay(50);tone1.play(570,100);
delay(110);tone1.play(500,100);
delay(150);tone1.play(760,100);
delay(50);tone1.play(720,100);
delay(75);tone1.play(680,100);
delay(75);tone1.play(620,150);
delay(150);tone1.play(650,200);
delay(150);tone1.play(1020,80);
delay(150);tone1.play(1020,80);
delay(75);tone1.play(1020,80);
delay(150);tone1.play(380,100);
delay(150);tone1.play(500,100);
delay(150);tone1.play(760,100);
delay(50);tone1.play(720,100);
delay(75);tone1.play(680,100);
delay(75);tone1.play(620,150);
delay(150);tone1.play(650,150);
delay(150);tone1.play(380,100);
delay(75);tone1.play(430,100);
delay(75);tone1.play(500,100);
delay(150);tone1.play(430,100);
delay(75);tone1.play(500,100);
delay(50);tone1.play(570,100);
delay(110);tone1.play(500,100);
delay(150);tone1.play(760,100);
delay(50);tone1.play(720,100);
delay(75);tone1.play(680,100);
delay(75);tone1.play(620,150);
delay(150);tone1.play(650,200);
delay(150);tone1.play(1020,80);
delay(150);tone1.play(1020,80);
delay(75);tone1.play(1020,80);
delay(150);tone1.play(380,100);
delay(150);tone1.play(500,100);
delay(150);tone1.play(760,100);
delay(50);tone1.play(720,100);
delay(75);tone1.play(680,100);
delay(75);tone1.play(620,150);
delay(150);tone1.play(650,150);
delay(150);tone1.play(380,100);
delay(75);tone1.play(430,100);
delay(75);tone1.play(500,100);
delay(150);tone1.play(430,100);
delay(75);tone1.play(500,100);
delay(50);tone1.play(570,100);
delay(210);tone1.play(585,100);
delay(275);tone1.play(550,100);
delay(210);tone1.play(500,100);
delay(180);tone1.play(380,100);
delay(150);tone1.play(500,100);
delay(150);tone1.play(500,100);
delay(75);tone1.play(500,100);
delay(150);tone1.play(500,60);
delay(75);tone1.play(500,80);
delay(150);tone1.play(500,60);
delay(175);tone1.play(500,80);
delay(75);tone1.play(580,80);
delay(175);tone1.play(660,80);
delay(75);tone1.play(500,80);
delay(150);tone1.play(430,80);
delay(75);tone1.play(380,80);
delay(300);tone1.play(500,60);
delay(75);tone1.play(500,80);
delay(150);tone1.play(500,60);
delay(175);tone1.play(500,80);
delay(75);tone1.play(580,80);
delay(75);tone1.play(660,80);
delay(225);tone1.play(870,80);
delay(162);tone1.play(760,80);
delay(300);tone1.play(500,60);
delay(75);tone1.play(500,80);
delay(150);tone1.play(500,60);
delay(175);tone1.play(500,80);
delay(75);tone1.play(580,80);
delay(175);tone1.play(660,80);
delay(75);tone1.play(500,80);
delay(150);tone1.play(430,80);
delay(75);tone1.play(380,80);
delay(300);tone1.play(660,100);
delay(75);tone1.play(660,100);
delay(150);tone1.play(660,100);
delay(150);tone1.play(510,100);
delay(50);tone1.play(660,100);
delay(150);tone1.play(770,100);
delay(225);tone1.play(380,100);
//tells the user it is over and delays it a little before going to the top again
delay(1000);
tone1.play(440,200);
delay(200);
delay(200);
tone1.play(440,400);
delay(200);
delay(200);
delay(5000);
}


bubulindo

fizeste include da libraria onde está definido o tipo Tone?

Eu não sou o teu criado. Se respondo no fórum é para ajudar todos mediante a minha disponibilidade e disposição. Responder por mensagem pessoal iria contra o propósito do fórum e por isso evito-o.
Se realmente pretendes que eu te ajude por mensagem pessoal, então podemos chegar a um acordo e contrato onde me pagas pela ajuda que eu fornecer e poderás então definir os termos de confidencialidade do meu serviço. De forma contrária toda e qualquer ajuda que eu der tem de ser visível a todos os participantes do fórum (será boa ideia, veres o significado da palavra fórum).
Nota também que eu não me responsabilizo por parvoíces escritas neste espaço pelo que se vais seguir algo dito por mim, entende que o farás por tua conta e risco.

Dito isto, mensagens pessoais só se forem pessoais, ou seja, se já interagimos de alguma forma no passado ou se me pretendes convidar para uma churrascada com cerveja (paga por ti, obviamente).

Radames

a novas versões da IDE do Arduino já incluem no core uma implementação da função Tone
veja em
http://arduino.cc/en/Reference/Tone
sendo assim vc não precisa incluir nenhuma lib no entanto vc precisa inicializar corretamente as instâncias do tipo Tone.

Luigi_xp

Ok, resolvido. foi só incluir o tone.h

Go Up