Light to control DC Motor

I've only had barely 1 month to learn Arduino for my new media art class and we've had less than a week to work on our transduction project. (last Thursday until this coming Thursday). My project is using a phototransistor to control a DC motor. Like the brighter the light the more it spins, the less the more it slows or stops. I think my circuit is okay because the motor works, but the phototransistor does not respond to light or darkness. Even my professor couldn't figure out what was wrong but I assume that my coding is wonky. I bought the starter kit and combined the code from the Light Theremin and Motorized Pinwheel projects.

int sensorValue;
int sensorLow = 1023;
int sensorHigh = 0;
const int ledPin = 13;
const int motorPin = 9;

void setup() {
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, HIGH);
while (millis() < 5000) {

sensorValue = analogRead(A0);
if (sensorValue > sensorHigh) {
sensorHigh = sensorValue;
}
if (sensorValue < sensorLow) {
sensorLow = sensorValue;
}
}

digitalWrite(ledPin, LOW);
}

void loop() {
sensorValue = analogRead(A0);
if (sensorValue == sensorLow) {
digitalWrite(motorPin, HIGH);
}
else {
digitalWrite(motorPin, LOW);
}
}

I have until Thursday (Oct 6) to get this to work. Please help if you can!

I think I have a picture of my circuit attached too.

it's difficult to see from your photo, but how is the sensor wired?
The sensor looks suspiciously like a LED - what is it really?

it's a phototransistor. It looks like an LED except it has a flat top. I used it when I first was trying Arduino and I made a theremin that used it to change the pitch of a piezo.

OK, that's answered half the questions.

Please use code tags when posting code. You can edit your post and

type
** **[code]** **
before your code
type
** **[/code]** **
after your code

OK, your setup() determines a low level. In loop you compare against that low level using '=='. Chances that the sensorValue is exactly that low level are not that big. You might want to use '<=' instead

void loop() {
  sensorValue = analogRead(A0);
  if (sensorValue <= sensorLow) {
    ...
    ...
  }
  else
  {
    ...
    ...
  }

You might also want to add a bit of play (hysteresis).

You can add some debugging to your code (use serial.println) and use serial monitor to display values that you have measured.

int sensorValue;
int sensorLow = 1023;
int sensorHigh = 0;
const int ledPin = 13;
const int motorPin = 9;

void setup() {

  Serial.begin(9600);

  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, HIGH);
  while (millis() < 5000) {

    sensorValue = analogRead(A0);
    if (sensorValue > sensorHigh) {
      sensorHigh = sensorValue;
    }
    if (sensorValue < sensorLow) {
      sensorLow = sensorValue;
    }
  }

  Serial.print("sensorLow = "); Serial.println(sensorLow);
  Serial.print("sensorHigh = "); Serial.println(sensorHigh);


  digitalWrite(ledPin, LOW);
}


void loop() {
  sensorValue = analogRead(A0);

  Serial.print("sensorValue = "); Serial.println(sensorValue);

  if (sensorValue <= sensorLow + 5) {  <---------------------- added a bit of hysteresis
    digitalWrite(motorPin, HIGH);
  }
  else {
    digitalWrite(motorPin, LOW);
  }
}

No idea about phototransistors so can't advise there; this is just the coding part.