Please post code inline between code </> tags.
Circuit is correct. Get out your multimeter and measure the actual voltage across the resistor, it should be no more than 5V. If it is, the sensor produces >20 mA and is probably broken (or your resistor value is >250Ω).