Accelerometer and Transistor

Here is my program, I want to:

1 The microcontroller, Arduino UNO R3 sends 3.3V to the sensor, Accelerometer, MMA7361 got from http://www.kynix.com/Search/MMA7361.html
2 The sensor turns on and send signal to the microcontroller.
3 When I move the sensor and if the voltage becomes more than 2V, the microcontroller sends 1.5V to the Transistor. Otherwise send 0V.

int outputPin1 = 3;   // Pin D3    
int outputPin2 = 5;  // Pin D5    
int analogPin = 0;  // Input Pin A0

void setup()    
{    
  pinMode (outputPin1, OUTPUT);   
  pinMode (outputPin2, OUTPUT);   
  Serial.begin(9600);   
}

void loop()    
{   
    int volts = 170; // send signals of 3.3v   
    analogWrite(outputPin1, volts);  // to Accelerometer   

    int reading = analogRead(analogPin);  //  receive signal
    delay(1000);    // delay 5sec.

    if (volts >= 100)    // Input voltage is more than 2.0V
    {
    int volts = 77; // send signals of 1.5V
    analogWrite(outputPin2, volts);  // to Transistor
    }
    else
      {
      int volts = 0;
      analogWrite(outputPin2, volts);  // to Transistor
      }
}

When I measure with Digital Multi Meter, it keeps showing 1.5V even it doesn’t change the position of the sensor.

I guess there’s some problem in the if, else line.

I think that you would have more answers with the Arduino forum.

Without any tests, I think that it misses something like pinMode (analogPin, INTPUT); in the setup function.
It is difficult to understand the goal of you loop function. You wan to write if (reading >= 100) instead of if (volts >= 100), no ?