Hi everyone
i am currently writing this simple code to check the temp sensor
#include <OneWire.h>

int DS18S20_Pin = 2; //DS18S20 Signal pin on digital 2

//Temperature chip i/o
OneWire ds(DS18S20_Pin); // on digital pin 2

void setup(void) {

void loop(void)
float temperature = getTemp();

delay(100); //just here to slow down the output so it is easier to read

I m getting "sketch_feb27a:14: error: 'getTemp' was not declared in this scope"
can someone tell me why?

getTemp() ; is a function that you should write in the sketch

the framework for it looks like

float getTemp()
  float f = -40; // quite cold!!
 // other implementation here
  return f;

add those lines to your sketch and give it a try

Where did you found that code ?
If you look again, it probably has a getTemp() function that does a lot of OneWire magic to get the temperature out of the sensor.

You probably need to write something like

float temp = ds.getTemp() ;

if the getTemp() function is a method of the class object ds.

I also tried this code

int sensorPin = A0;
void setup()
void loop()
    int reading = analogRead(sensorPin);
    float voltage = reading * 5.0 / 1024;
    float temperatureC = (voltage - 0.5) * 100;
    Serial.print(temperatureC); Serial.print(" degrees C, ");
    Serial.print(voltage); Serial.println(" volts");

but this time the voltage and temperature kept varying too much... i also tried your solution robtillart but i had to come out with the formula for the R... and this is doing the same in theory but in the loop

I suggest you drop everything, get onto a decent tutorial, and read it thoroughly.

Here is the one I use.

Note that two programmes are used, one to get the addresses of the sensors, and one to actually use them.

There's also a good basic tutorial & sketch at

when i tried that one on bildr.com, it gives always give me -1000C
Do you know why?

-1000 is the default 'error' temp it returns when it detects an invalid address, CRC error, etc. you'll have to play around and do some debugging to figure out exactly where the error is occurring. (I.e. Is it not finding the device, is it detecting an invalid address, etc)

Do you have it wired correctly with a pull up resistor?