Talkie library problem

Hey i'm new on the forum and i have a problem with the talkie library. I control it with a IR Remote Control, but after i trigger the Command, nothing works anymore. I can't trigger other commands or the same again and i don't know why. I link the code below and sorry for my bad english.

#include "Talkie.h"
#include "Vocab_US_TI99.h"
#include "Stepper.h"
#include "IRremote.h"



/*----- Variablen, Pins -----*/
#define STEPS  32   // Number of steps per revolution of Internal shaft
int  Steps2Take;  // 2048 = 1 Umdrehung
int receiver = 12; // Signal Pin von Empfänger auf Pin 6

/*-----( Objekte deklarieren )-----*/
// Setup of proper sequencing for Motor Driver Pins
// In1, In2, In3, In4 in the sequence 1-3-2-4
Stepper links_stepper(STEPS, 0, 2, 1, 3);
Stepper rechts_stepper(STEPS, 4, 6, 5, 7);
Stepper zunge_stepper(STEPS, 8, 13, 9, 10);


IRrecv irrecv(receiver);    // Kreiert instanz von 'irrecv'
decode_results results;     // Kreiert instanz von 'decode_results'

  
void setup()
{ 
  irrecv.enableIRIn(); // Startet Empfänger
  
}


void reden() {
  Talkie voice;
  voice.say(spt_DO);
  voice.say(spt_YOU);
  voice.say(spt_HAVE);
  voice.say(spt_THINGS);
  voice.say(spt_YOU);
  voice.say(spt_WANT);
  voice.say(spt_TO);
  voice.say(spt_GIVE);
  voice.say(spt_ME);
  
}

void fahrenlinks() {
  links_stepper.setSpeed(500); //Max 500
  Steps2Take  =  50 ;  
  links_stepper.step(Steps2Take);
}

void fahrenrechts() {
  rechts_stepper.setSpeed(500);
  Steps2Take = 50;
  rechts_stepper.step(Steps2Take);
}
void fahrengerade() {
  Steps2Take = 1;
  int timer;
  links_stepper.setSpeed(500);
  rechts_stepper.setSpeed(500);
  for(timer = 0; timer <= 200; timer++) {
    Steps2Take = 1;
    rechts_stepper.step(Steps2Take);
    links_stepper.step(Steps2Take);    
  }
   
}

void zunge() {
  zunge_stepper.setSpeed(500);
  Steps2Take = 1024;
  zunge_stepper.step(Steps2Take);
}

void fahrenlinksreset() {
  links_stepper.setSpeed(500); //Max 500
  Steps2Take  =  -50;  
  links_stepper.step(Steps2Take);
}

void fahrenrechtsreset() {
  rechts_stepper.setSpeed(500);
  Steps2Take = -15;
  rechts_stepper.step(Steps2Take);
}
void fahrengeradereset() {  
  int timer;
  links_stepper.setSpeed(500);
  rechts_stepper.setSpeed(500);
  for(timer = 0; timer <= 200; timer++) {
    Steps2Take = -1;
    rechts_stepper.step(Steps2Take);
    links_stepper.step(Steps2Take);    
  }
   
}
void zungereset() {
  zunge_stepper.setSpeed(500);
  Steps2Take = -1024;
  zunge_stepper.step(Steps2Take);
}

  
void loop() {
if (irrecv.decode(&results)) // checkt ob signal

  {
    switch(results.value)

    {

      case 0xFF22DD: // dreht sich links
                      fahrenlinks();
                      break;
                      
      case 0xFFC23D: // dreht sich rechts
                      fahrenrechts();
                      break;
      case 0xFF629D: //fährt geradeaus
                      fahrengerade();
                      break;
      case 0xFFE01F: // stopt links drehen
                      fahrenlinksreset();
                      break;
      case 0xFF906F: // stop rechts drehen
                      fahrenrechtsreset();
                      break;
      case 0xFF02FD: // stop fahren
                      fahrengeradereset();
                      break;
      case 0xFF30CF: //1
                      zunge();
                      break;
      case 0xFF18E7: //2
                      zungereset();
                      break;  

      case 0xFF7A85: //reden
                      reden();
                      
                      break;


      
         

                
    }
    
      irrecv.resume(); 
                 digitalWrite(5, LOW);
                 digitalWrite(6, LOW);
                 digitalWrite(7, LOW);
                 digitalWrite(0, LOW); 
                 digitalWrite(1, LOW);
                 digitalWrite(2, LOW);
                 digitalWrite(3, LOW);
                 digitalWrite(4, LOW);                       
  }  

}/* --ende von main loop -- */

after i trigger the "reden" function(german for talking) i can't trigger other functions anymore

ps: i changed the timer in the IRremoteInt.h ( in the ir remote library). i don't think that causes problems but i wanted to mention it.

Hello
did you check the right code position of:

inside the sketch?
mir sind zu viele Leerzeilen drin

Talkie uses Timer1 and Timer2. IRremote uses a timer. It might not be possible to use both in the same sketch on an Arduino UNO. If you switch to an Arduino MEGA you might be able to configure the IRremote library to use one of the additional timers.

Thats why changed the timer in the IRremote library. At first i got an error message that both use the timer. After i changed it, i didn't g got one anymore so i thought its okay.

The Code is based on an example code, where the

irrecv.resume(); 

is on the same place. So i thought i had to be on the same place

that's the example code:

#include "Stepper.h"
#include "IRremote.h"


/*----- Variables, Pins -----*/
#define STEPS  32   // Number of steps per revolution of Internal shaft
int  Steps2Take;  // 2048 = 1 Revolution
int receiver = 12; // Signal Pin of IR receiver to Arduino Digital Pin 6

/*-----( Declare objects )-----*/
// Setup of proper sequencing for Motor Driver Pins
// In1, In2, In3, In4 in the sequence 1-3-2-4
Stepper small_stepper(STEPS, 0, 2, 1, 3);

IRrecv irrecv(receiver);    // create instance of 'irrecv'
decode_results results;     // create instance of 'decode_results'

void setup()
{ 
  irrecv.enableIRIn(); // Start the receiver
}

void loop()
{
if (irrecv.decode(&results)) // have we received an IR signal?

  {
    switch(results.value)

    {

      case 0xFF629D: // VOL+ button pressed
                      small_stepper.setSpeed(500); //Max seems to be 500
                      Steps2Take  =  4048;  // Rotate CCW
                      small_stepper.step(Steps2Take);
                      delay(2000); 
                      break;
      case 0xFFA857: // VOL- button pressed
                      small_stepper.setSpeed(500);
                      Steps2Take  =  -4048;  // Rotate CW
                      small_stepper.step(Steps2Take);
                      delay(2000); 
                      break;

                
    }
    
      irrecv.resume(); // receive the next value
                 digitalWrite(8, LOW);
                 digitalWrite(9, LOW);
                 digitalWrite(10, LOW);
                 digitalWrite(11, LOW);       
  }  


}/* --end main loop -- */


Move this line out of reden() (make it global) and tell us what happens:

  Talkie voice;

Tried that already. Unfortunately it didn't solve anything.

Of course that won't solve anything.

My guess is that that line causes the problem (due to a resource conflict), so the failure should have appeared earlier, if you make it global.

Post your modified IRremote library and explain what you changed.

#include "Talkie.h"
#include "Vocab_US_TI99.h"
#include "Stepper.h"
#include "IRremote.h"
Talkie voice;
/*----- Variablen, Pins -----*/
#define STEPS  32   // Number of steps per revolution of Internal shaft
int  Steps2Take;  // 2048 = 1 Umdrehung
int receiver = 12; // Signal Pin von Empfänger auf Pin 6

/*-----( Objekte deklarieren )-----*/
// Setup of proper sequencing for Motor Driver Pins
// In1, In2, In3, In4 in the sequence 1-3-2-4
Stepper links_stepper(STEPS, 0, 2, 1, 3);
Stepper rechts_stepper(STEPS, 4, 6, 5, 7);
Stepper zunge_stepper(STEPS, 8, 13, 9, 10);
IRrecv irrecv(receiver);    // Kreiert instanz von 'irrecv'
decode_results results;     // Kreiert instanz von 'decode_results'
 
void setup()
{ 
  irrecv.enableIRIn(); // Startet Empfänger
  
}

void reden() {
  
  voice.say(spt_DO);
  voice.say(spt_YOU);
  voice.say(spt_HAVE);
  voice.say(spt_THINGS);
  voice.say(spt_YOU);
  voice.say(spt_WANT);
  voice.say(spt_TO);
  voice.say(spt_GIVE);
  voice.say(spt_ME);
  
}

void fahrenlinks() {
  links_stepper.setSpeed(500); //Max 500
  Steps2Take  =  50 ;  
  links_stepper.step(Steps2Take);
}

void fahrenrechts() {
  rechts_stepper.setSpeed(500);
  Steps2Take = 50;
  rechts_stepper.step(Steps2Take);
}
void fahrengerade() {
  Steps2Take = 1;
  int timer;
  links_stepper.setSpeed(500);
  rechts_stepper.setSpeed(500);
  for(timer = 0; timer <= 200; timer++) {
    Steps2Take = 1;
    rechts_stepper.step(Steps2Take);
    links_stepper.step(Steps2Take);    
  }
   
}

void zunge() {
  zunge_stepper.setSpeed(500);
  Steps2Take = 1024;
  zunge_stepper.step(Steps2Take);
}

void fahrenlinksreset() {
  links_stepper.setSpeed(500); //Max 500
  Steps2Take  =  -50;  
  links_stepper.step(Steps2Take);
}

void fahrenrechtsreset() {
  rechts_stepper.setSpeed(500);
  Steps2Take = -15;
  rechts_stepper.step(Steps2Take);
}
void fahrengeradereset() {  
  int timer;
  links_stepper.setSpeed(500);
  rechts_stepper.setSpeed(500);
  for(timer = 0; timer <= 200; timer++) {
    Steps2Take = -1;
    rechts_stepper.step(Steps2Take);
    links_stepper.step(Steps2Take);    
  }
   
}
void zungereset() {
  zunge_stepper.setSpeed(500);
  Steps2Take = -1024;
  zunge_stepper.step(Steps2Take);
}
  
void loop() {
if (irrecv.decode(&results)) // checkt ob signal
  {
    switch(results.value)

    {

      case 0xFF22DD: // dreht sich links
                      fahrenlinks();
                      break;
                      
      case 0xFFC23D: // dreht sich rechts
                      fahrenrechts();
                      break;
      case 0xFF629D: //fährt geradeaus
                      fahrengerade();
                      break;
      case 0xFFE01F: // stopt links drehen
                      fahrenlinksreset();
                      break;
      case 0xFF906F: // stop rechts drehen
                      fahrenrechtsreset();
                      break;
      case 0xFF02FD: // stop fahren
                      fahrengeradereset();
                      break;
      case 0xFF30CF: //1
                      zunge();
                      break;
      case 0xFF18E7: //2
                      zungereset();
                      break;  

      case 0xFF7A85: //reden
                      reden();
                      break;          
    } 
      irrecv.resume(); 
                 digitalWrite(5, LOW);
                 digitalWrite(6, LOW);
                 digitalWrite(7, LOW);
                 digitalWrite(0, LOW); 
                 digitalWrite(1, LOW);
                 digitalWrite(2, LOW);
                 digitalWrite(3, LOW);
                 digitalWrite(4, LOW);
                 digitalWrite(8, LOW);
                 digitalWrite(9, LOW);
                 digitalWrite(10, LOW);
                 digitalWrite(11, LOW);
                 digitalWrite(13, LOW);                       
  }  
}/* --ende von main loop -- */

I took the Tallkie voice
out of the "reden" funtion and put it after the #include at the very beginning. After i trigger the function "reden" with the remote control, all the other funtions are frozen. Nothing ahppens when i push the buttons. I think it doesnt matter where "Talkie voice" is defined.

Post your modified IRremote library and explain what you changed.

As already pointed out, after including the Talkie library, all the available timers on an ATmega328 are in use.

That means no other possible solutions? I have to switch to a MEGA?

It is possible to reprogram a timer every time you change its intended use.

Is it possible for a beginner like me? Or too challenging

Most people should be able to learn how the timers are programmed. Study of the processor data sheet and the timer sections of the source code you intend to use (the libraries) is essential.

Or buy an Arduino with more timers, and but first make sure that all the libraries support it.

Just because you don't get an error does not me there isn't a conflict. I told you that the Talkie library used both Timer1 and Timer2. Which timer did you tell the IRremote library to use?

You can comment out this line in 'talkie.cpp' and it will set up the timers every time you call voice.say():
` setup = 1;'
You will have to find a way to get the IRremote library to re-initialize the timer after you are done talking.

1 Like

I don't have any clue how i could do this

You do this by finding the file talkie.cpp in the library folder and placing // in front of that instruction.