Osgeld is correct. For a basic analog input -> transistor setup, it'd look like this:
int input = 0; //analog input 0 is connected to the sensor
int output = 2; //digital pin 2 is connected to the transistor base
int threshold = 500; //the level at which the output will be triggered
void setup()
{
pinMode(output, OUTPUT); //initializes pin 2 as an output
}
void loop() {
if (analogRead(input) > threshold) //is the value higher than 500?
{
digitalWrite(output, HIGH); //if so, turn on the transistor
}
else
{
digitalWrite(output, LOW); //if not, turn off the transistor
}
delay(50); //just in case
}
DISCLAIMER: I have not tested that code.