using analog inputs with digital inputs

Im using a standard analog input and PWM output program. Im using a temperature transmitter to control a PWM output to control a cooling fan. The problem is I need the fan to go full speed when air-conditioning is on and cant get it to work. Here is the analog program I'm using. HELP!

const int analogInPin = A0;
const int analogOutPin = 9;

int sensorValue = 0;
int outputValue = 0;

void setup() {

Serial.begin(9600);
}

void loop() {

sensorValue = analogRead(analogInPin);

outputValue = map(sensorValue, 0, 1023, 0, 255);

analogWrite(analogOutPin, outputValue);

Serial.print("sensor = ");
Serial.print(sensorValue);
Serial.print("\t output = ");
Serial.println(outputValue);

delay(2);

}

please post within </> code-tags.

and cant get it to work.

what is the output in the serial monitor ?
how do you tell the Arduino the airconditioner is on ?
how have you wired things up ?

outputValue = sensorValue / 4;

You don't seem to call pinMode( analogOutPin, OUTPUT ) during setup().

Blackfin:
You don’t seem to call pinMode( analogOutPin, OUTPUT ) during setup().

analogWrite does that for you.

Blackfin:
You don't seem to call pinMode( analogOutPin, OUTPUT ) during setup().

analogWrite does that for you.

pwm328x.png
Figure-1: Pre-defined PWM signals for analogWrite() function

When user executes the following codes, the indicated DPins automatically configured as output lines and convey PWM signals of the specified frequency (Fig-1).

analogWrite(3, dutyCycle);     //490 Hz PWM signal at DPin-3
analogWrite(11, dutyCycle);   //490 Hz PWM signal at DPin-11

analogWrite(10, dutyCycle);     //490 Hz PWM signal at DPin-10
analogWrite(9, dutyCycle);     //490 Hz PWM signal at DPin-9

analogWrite(5, dutyCycle);     //980 Hz PWM signal at DPin-5
analogWrite(6, dutyCycle);     //980 Hz PWM signal at DPin-6

pwm328x.png