Analogwrite problem

Hi I'm new in electronic and I have a Teensy++ and when I try to combine 2 working programes, one doesn't work
the first is a extensometer that control the angle of a servo
the second is a RGB LED increasing light intensity with a extensometer

Together the LED dont open at all... I did few test and found that digitalwrite could open the LED but only on a constant value. So I puted a delay following the extensometer resistance to make it blink faster when there would be more flexion, but the servo started to choke, due to the too long delay it was taking to update his angle from the program. Im pretty sure the problem is in the ''Analogwrite'' command but I dont know how to fix it.

thank you
Dom

#include <Servo.h>

Servo myservo; // create servo object to control a servo

int val; // variable to read the value from the analog pin

void setup()
{ Serial.begin(38400); to read the value on computer
pinMode(15, OUTPUT); its a blue LED

myservo.attach(26); // attaches the servo on pin 9 to the servo object
}

void loop()
{
Serial.println(analogRead(39));to read the value on computer
analogWrite(15, 310-analogRead(39)); /light changing with flexions (DOESNT WORK)/
val = analogRead(38); // reads the value of the extentiometer (value between 0 and 1023)
val = map((7.3*(val-180)), 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180) 179
myservo.write(val); // sets the servo position according to the scaled value
delay(5); // waits for the servo to get there 15
}

please use code tags when posting
ehm did you forgot // marks in your setup part.
is see you also use it once / but it should be double //
oh and i think analog write can only have values between 0 and 255

 Serial.println(analogRead(39));to read the value on computer

What is the compiler supposed to do there?
You need // after the ;

thanks PGTBOOS, i'll try to learn to use code tag
ill try to change the // marks and change the values to be between 0 and 255
your help is sincerly appreciated

the compiler is just a witness that the program works

No, the compiler is just a witness to the fact that the program is syntactically correct.
It cannot guarantee that the program will behave correctly.

DominikS:
thanks PGTBOOS, i'll try to learn to use code tag

Please edit your post, select the code, and put it between [code] ... [/code] tags.

You can do that by hitting the # button above the posting area.