Outputting Voltage

This is a simple matter of changing one line. Our sensor outputs 10mv per degree centigrade so to get voltage we simply display the result of getVoltage(). Delete the line:

     temperature = (temperature - .5) * 100;

Outputting degrees Fahrenheit

Again this is a simple change requiring only math. to go degrees C -> degrees F we use the formula:
    ( F = C * 1.8) + 32 )

Add the line:
    temperature = (((temperature - .5) * 100)*1.8) + 32; before Serial.println(temperature);

More informative output

Lets add a message to the serial output to make what is appearing in the Serial Monitor more informative.

To do this, change this line:



Then, we add another line with informative text about the temperature on a new line:
  Serial.println(" degrees centigrade");

The change to the first line means when we next output it will appear on the same line.

Changing the serial speed

If you ever wish to output a lot of data over the serial line time is of the essence. We are currently transmitting at 9600 baud but much faster speeds are possible.

To change this change the line:




Upload the sketch turn on the serial monitor, then change the speed from 9600 baud to 115200 baud in the pull down menu. You are now transmitting data 12 times faster.

This guide was first published on Aug 18, 2017. It was last updated on Jan 17, 2018.

This page (Make It Better) was last updated on Jun 27, 2017.

Text editor powered by tinymce.