Can someone explain why my motor wont turn off

having a problem with my code where the motor will turn on at the specified time, but it wont turn off at all. i want my motor to spin for 10 seconds at two predetermined times throughout the day (930am and 530pm) currently the motor will turn on at those times but it will not turn off after 10 seconds has passed. The motor will continue to run until i reset the arduino. I am using a sainsmart arduino and a seeedstudio motorshield and a ds3231 RTC.

here is my code (i had an lcd i was using but had to take that off since it uses some of the pins that they motorshield is using.)

#include <Wire.h>
#include "RTClib.h"
#include <LiquidCrystal.h>
#include <TimeAlarms.h>
#include <Time.h>

RTC_DS1307 RTC;
//LiquidCrystal lcd(8, 13, 9, 4, 5, 6, 7);
//int motorPin = 2;
int lastHour = 23;
int lastMinute = 59;

bool feedPet = false;
unsigned long feedTime = 0;
unsigned long lastPrintTime = 0;

struct FeedTime {
  int hour, minute;
};

FeedTime amFeed = {9, 30};  // i.e. 9:30am
FeedTime pmFeed = {17, 30};  // i.e. 5:30pm

//sets up motor 1
int pinI1 = 8;
int pinI2 = 11;
int speedpin1 = 9;

//sets speed of motors
int speed = 255;

void setup ()
{
  //pinMode(motorPin, OUTPUT);
  Serial.begin(9600);
  //lcd.begin(16, 2);
  Wire.begin();
  RTC.begin();
  pinMode (pinI1, OUTPUT);
  pinMode (pinI2, OUTPUT);
  pinMode (speedpin1, OUTPUT);

  /*{
    lcd.println("RTC NOT Running!");
    RTC.adjust(DateTime((__DATE__), (__TIME__)));
  }*/
}

void loop ()
{
  DateTime now = RTC.now();
  FeedTime currentTime;
  currentTime.hour = now.hour();
  currentTime.minute = now.minute();
  if ((currentTime.minute != lastMinute) && (((currentTime.hour == amFeed.hour) && (currentTime.minute == amFeed.minute)) || ((currentTime.hour == pmFeed.hour) && (currentTime.minute == pmFeed.minute))))
  {
    feedTime = millis();
    feedPet = true;
  }
  lastMinute = currentTime.minute;
  if (feedPet)
  {
    turnFeeder();
  }
  if (millis() - lastPrintTime > 1000UL)
  {
    /*lcd.setCursor(0, 0);
    char nowDate[24] = "";
    sprintf(nowDate, "DATE: %02d/%02d/%d", now.month(), now.day(), now.year());
    lcd.print(nowDate);
    // display the time
    lcd.setCursor(0, 1);
    char nowTime[24] = "";
    sprintf(nowTime, "Time: %02d:%02d:%02d", now.hour(), now.minute(), now.second());
    lcd.print(nowTime);
    lastPrintTime = millis();*/
  }

  analogWrite(speedpin1, speed);
}

void turnFeeder(void)
{
  static bool pinState = true;
  if (millis() - feedTime < 1000UL) // 10 second(s)
  {
    if (pinState)
    {
      //digitalWrite(motorPin, HIGH); <<<<old way without motorshield
      digitalWrite(pinI2, LOW);
      pinState = false;
    }
  }
  else
  {
    //digitalWrite(motorPin, LOW); <<<<old way without motorshield
    digitalWrite(pinI1, HIGH);
    pinState = true;
    feedPet = false;
  }
}

Are you sure you want "< 1000UL" instead of "> 1000UL" ?

The problem lies with these two lines IMO

//digitalWrite(motorPin, HIGH);
digitalWrite(pinI2, LOW);

//digitalWrite(motorPin, LOW);
digitalWrite(pinI1, HIGH);
pinState = true;

If you change the else block to make pinI2 go LOW instead of HIGH, your motor will stop when the time is right.

Let me know if that fixes it.

yes i am sure i want this

Are you sure you want "< 1000UL" instead of "> 1000UL" ?

no that does not seem to work. atleast not by the way i did it, maybe you did it a different way, please show me your way..

this is my way

void turnFeeder(void)
{
  static bool pinState = true;
  if (millis() - feedTime < 1000UL) // 10 second(s)
  {
    if (pinState)
    {
      //digitalWrite(motorPin, HIGH);
      digitalWrite(pinI2, LOW);
      pinState = true;
    }
  }
  else
  {
    //digitalWrite(motorPin, LOW);
    digitalWrite(pinI1, HIGH);
    pinState = false;
    feedPet = false;
  }
}

got it fixed. Thanks for finding my mistake, i was under the assumption that the two were positive and negative connections for the 1 motor controller. i was wrong and using just pinI2 worked, i even got the lcd to work with everything