Did I break my motor shield?

Alright, here goes.

The motor, by itself, reads 11.4 ohms when unpowered. I never smelled anything burning, but I wondered if I might have shorted something on the board by connecting the wrong wire somewhere by accident.

I attached a schematic (hopefully it's legible). There are three wires soldered together running to the 5V pin -- the IR sensor, the On/Off switch for switching to "Manual mode", and the push button that runs the motor when the box is in "Manual mode". All of the grounds run to the right side of the breadboard, where they're tied into a common soldered ground.

Something else that made me think something was wrong with the board was that I wasn't even able to get the IR sensor to give any legitimate readings.

I haven't attached the RFID reader yet because I wanted to diagnose the other problems first.

I ran the MotorTest app as shown here, and it didn't work by itself -- but it did run before I attached the other components.

// Adafruit Motor shield library
// copyright Adafruit Industries LLC, 2009
// this code is public domain, enjoy!

#include <AFMotor.h>

AF_DCMotor motor(3);

void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Motor test!");

  // turn on motor
  motor.setSpeed(200);
 
  motor.run(RELEASE);
}

void loop() {
  uint8_t i;
  
  Serial.print("Speeding up forward... ");
  
  motor.run(FORWARD);
  for (i=0; i<255; i++) {
    motor.setSpeed(i);  
    delay(10);
 }
 
 Serial.print("Slowing down forward... ");
 
  for (i=255; i!=0; i--) {
    motor.setSpeed(i);  
    delay(10);
 }
 
 Serial.print("Stopping for one second...");
 
 motor.run(RELEASE);
 delay(1000);

 Serial.print("Speeding up backward... ");

  motor.run(BACKWARD);
  for (i=0; i<255; i++) {
    motor.setSpeed(i);  
    delay(10);
 }
 
 Serial.print("Slowing down backward... ");
 
  for (i=255; i!=0; i--) {
    motor.setSpeed(i);  
    delay(10);
 }
  

  Serial.print("Stopped. ");
  motor.run(RELEASE);
  delay(1000);
}

Here's the code for the Pet Feeder itself:

#include <Adafruit_MotorShield.h>
#include <SoftwareSerial.h>
#include <AFMotor.h>

const int MODE_pin=16;
const int MANUALOPEN_pin=17;
const int IR_pin = 4;   
const int IR_cutoff=200;
int printed_already;

//RF reader is connected to RX pin 0 for serial input

const int OPEN=1;
const int CLOSE=0;
int door_state;
int val; 

const int set_time1=5000;
long startMillis;
AF_DCMotor motor(3, MOTOR12_64KHZ); 
SoftwareSerial mySerial(2, 3);

int incomingByte = 0; 

void setup() {
  Serial.begin(9600);           
  mySerial.begin(9600);
  Serial.println("Cat feeder!");
  motor.setSpeed(200);
  digitalWrite(16, LOW);
  digitalWrite(17, LOW);
  door_state=CLOSE;
  printed_already=0;
}

void loop() {
  byte valr;
  if(digitalRead(MODE_pin)==LOW) //switch set to manual
  {
    delay(10);
    if(digitalRead(MODE_pin)==LOW)//debouncing
    {
     if((printed_already==0) || (printed_already==2))
     {
     Serial.println("MODE = manual");
     printed_already=1;
     }
      if(digitalRead(MANUALOPEN_pin)==HIGH) //toggle button is pressed
      {
        delay(10);
        if(digitalRead(MANUALOPEN_pin)==HIGH)//debouncing
        {  
          if(door_state==OPEN)  
          {
            Serial.println("trying to close now ...");
            MoveDoor(CLOSE);//close the door
          }
          else if(door_state==CLOSE)  
          {
            Serial.println("trying to open now ...");
            MoveDoor(OPEN);//close the door
          }          
        }
      }
    }
  }
  else if(digitalRead(MODE_pin)==HIGH) //switch set to automatic
  {  
  delay(10);
  if(digitalRead(MODE_pin)==HIGH) //debouncing
    {
    if((printed_already==0) | (printed_already==1))
     {
      Serial.println("MODE = automatic");
      printed_already=2;
     }  
    if((RFID() == 1) && (door_state==CLOSE))//RF activated
      {
      MoveDoor(OPEN);
      }
    else //RF not active, we may have to close the door
      {
      if(door_state==OPEN)//DOOR is open
        {
        if(analogRead(IR_pin)<IR_cutoff)//there is no cat
          {
          startMillis = millis();
          Serial.println("starting timer...");
          //while nothing happens, the timer runs out
          while(millis()-startMillis<set_time1) 
            {
            if(millis()%500<5)
            Serial.println(analogRead(IR_pin));  
            if(analogRead(IR_pin)>=IR_cutoff)
              {
              Serial.println("Cat detected. Resetting timer ...");
              delay(1000);
              startMillis = millis();
              }
            }  
        
          if(analogRead(IR_pin)<IR_cutoff) 
          //RF is still not activated, there really is no cat
            {
            Serial.println("Timer ran out.");  
              while(mySerial.available())
              valr = mySerial.read();//empty the buffer
            MoveDoor(CLOSE); //close the door
            }
          }
        }  
      }
    }
  }
}  
    
    
void MoveDoor(int openclose)
    {
    int cat_alert;
    cat_alert=0;  
    if(openclose==CLOSE) //close the door!
      {
      motor.run(BACKWARD); 
      delay(2000); //run the motor for 1.5 seconds to close the door  
      while (cat_alert==0)
         {if(analogRead(IR_pin)>IR_cutoff)
           {delay(20);
           if(analogRead(IR_pin)>IR_cutoff)
             {
             cat_alert=1;  
             motor.run(RELEASE);
             openclose=OPEN;
             }
           }
         }  
      
       //if there is no cat
       //if there is, door opens in next if-statement
        if(cat_alert==0)
          {
          motor.run(RELEASE);
          door_state=CLOSE;
          Serial.println("it's closed.");
          }
      }
    
    if(openclose==OPEN) //open the door!
      { 
      motor.run(FORWARD); 
      delay(2000); //run the motor for 1.5 seconds to open the door
      motor.run(RELEASE); 
      door_state=OPEN;
      Serial.println("it's open.");
      }

}    
    
int RFID() 
  {
  byte i = 0;
  byte val = 0;
  byte code[6];
  byte checksum = 0;
  byte bytesread = 0;
  byte tempbyte = 0;
  int result = 0;

  if(mySerial.available()) {
    result=1;
    if((val = mySerial.read()) == 0x02) { 
      bytesread = 0; 
      Serial.println("I read it");
      while (bytesread < 12) {// read 10 digit code + 2 digit checksum
        if(mySerial.available()) { 
          val = mySerial.read();
          if((val == 0x0D)||(val == 0x0A)||(val == 0x03)||(val == 0x02)) {  
            break; // stop reading
          }

          // Do Ascii/Hex conversion:
          if ((val >= '0') && (val <= '9')) {
            val = val - '0';
          } else if ((val >= 'A') && (val <= 'F')) {
            val = 10 + val - 'A';
          }

          // Every two hex-digits, add byte to code:
          if (bytesread & 1 == 1) {
            // make some space for this hex-digit by
            // shifting the previous hex-digit with 4 bits to the left:
            code[bytesread >> 1] = (val | (tempbyte << 4));

            if (bytesread >> 1 != 5) {// If we're at the checksum byte,
              checksum ^= code[bytesread >> 1];// Calculate the checksum... (XOR)
            };
          } else {
            tempbyte = val; // Store the first hex digit first...
          };
          bytesread++; // ready to read next digit
        } 
      } 

      // Output to Serial:

      if (bytesread == 12) {  // if 12 digit read is complete
        Serial.print("5-byte code: ");
        for (i=0; i<5; i++) {
          if (code[i] < 16) mySerial.print("0");
          Serial.print(code[i], HEX);
          Serial.print(" ");
        }
        Serial.println();
        Serial.print("Checksum: ");
        Serial.print(code[5], HEX);
        Serial.println(code[5] == checksum ? " -- passed." : " -- error.");
        if(code[5] == checksum)
        result=1;
        Serial.println();
      }
      bytesread = 0;
    }
  }
  return result;
}