beginer in coding NEED HELP!

Hi Luther,

With Arduino, we have the function Serial.parseFloat(), which returns a float type number, which is easily printed with Serial.println(). So read a centigrade number with parseFloat, add 273.15, print out the Kelvin result with println.

ParseFloat() takes the place of your "readline" function. The Arduino Serial functions are very useful for this kind of utilitarian programming. Use parseFloat to get a floating point number from the Serial input. You can write your own filtration to be sure it's a number, within range, etc.

Here is the simplest example using these two functions in concert, to do a simple arithmatic operation:

void setup() {
  Serial.begin(9600);
}

void loop() {
  while (Serial.available() > 0) {
    float temperature = Serial.parseFloat();

    if (Serial.read() == '\n') {
      temperature = temperature + 273.15;
      Serial.println(temperature);
    }
  }
}

Upload this code to an Arduino Uno. Then open the Serial Monitor from the Arduino software, and enter a decimal number that is greater than -273,15.