SD Cards and Servos - but Servo not responding

All

I have combined different code which work by themselves. However when combined, the servo does not move despite what appears to be the code working …
I do not doubt the servo itself as I it works using the arduino examples

The code receives an IR remote signal ok and interprets it using a case statement ok. Once received the code reads the SD Card ok and plays a corresponding sound ok. I then added instruction for the servo to move for “case 0x3D9AE3F7”. Using the serial monitor I see the variable “pos” changes as expected. "pos"is required to move the servo (myServo.write(pos))… but the servo doesn’t move ??

Am I missing something ?

Here is the code:

// Title: IR Reader and Action Trigger (inc Sound Files on SD Card) + TBC
// Date:  31 May'15
// Notes: Compiled ok and worked on 31May after adding case/switch routine from Tronixstuff.com 
// 
/////////////////////////////////////////////////////////////////////////////////

// IRremote Libraries
#include <IRremote.h>
#include <IRremoteInt.h>
int RECV_PIN = 7;            // using digital pin 7 on Uno for IR Rx. Chgd from 11 to 7 as conflict'd with SDcard MOSI pin
IRrecv irrecv(RECV_PIN);
decode_results results;

// SD Card Libraries
#include <SPI.h>
#include <SD.h>                
#define SD_ChipSelectPin 4     // using digital pin 4 on arduino nano 328 for SD card select (CS)
#include <TMRpcm.h>            // also need to include this library...
TMRpcm tmrpcm;                 // create an object for use in this sketch
char mychar;

// Servo Libraries
#include <Servo.h>            // imports servo library
Servo myServo;                // associated myservo object will all resources in servo library
int pos = 0;                  // variable to store the servo position 


void setup() 
{ // put your setup code here, to run once:
  Serial.begin(9600);
  irrecv.enableIRIn();               // start the receiver
  tmrpcm.speakerPin = 9;             // using digital pin 9 on Uno, Nano (11 on Mega) for Spkr output
  //tmrpcm.setVolume(7);               // **set volume level - 0 (low) to 7 (high). (added 310515 if doesnt work delete)**
  myServo.attach(6);                   // attaches the servo on pin 6(was 9) to the servo object
  
  if (!SD.begin(SD_ChipSelectPin))   // see if the card is present and can be initialized:
   { 
    Serial.println("SD fail");  
    return;                          // don't do anything more if not
   }
   tmrpcm.play("start.wav");         // Sound file "Start" will play each time arduino powers up, or is reset
}

void translateIR() 
{ // put your main code here, take action based on IR code rxd
   switch(results.value)
     {
       case 0x9716BE3F: tmrpcm.play("button1.wav"); Serial.println(" Button #1"); break;        // Check IR input for hex 9716BE3F(for button1)to start playback
       case 0x3D9AE3F7: 
         tmrpcm.play("button2.wav"); 
         Serial.println(" Button #2");

         // servo sketch
         for(pos = 0; pos < 90; pos += 1)  // goes 0 deg to 90 deg
 	   {                               // in steps of 1 degree 
     	    myServo.write(pos);           // servo goto posn var.'pos' 
            Serial.print(" Pos");
            Serial.print(pos);
            delay(15);               //wait 15ms for servo to reach posn
           }
         // servo sketch         
         
         break;        // Check IR input for hex 3D9AE3F7(for button2)to start playback
       case 0x6182021B: tmrpcm.play("R2D2.wav"); Serial.println(" Button #3"); break;           // Check IR input for hex 6182021B(for button3)to start playback
       default: Serial.println(" Nothing ?");  
     }
   delay(300);                      // adds a short delay (consider removing later as use of delay() in a sketch has significant drawbacks)
}

void loop() 
{// put your main code here, to run repeatedly:
   if (irrecv.decode(&results))   // Check we have received am IR Signal and run Sub routine ?
   {                              
      translateIR();              // run the Case routine to check on value rxd
      irrecv.resume();            // receive next IR value
   }
}

Have you checked to see if there is a timer conflict between the servo and IR libraries?

Good questions and what I have been thinking....

But can I check there is a conflict and how might I overcome this ?

You could try the SevoTimer2 library.

...R