tempSensor.F/C

Category:Circuit Playground

Converts tempSensor.value to an easy to read temperature in either the Celsius or Fahrenheit scales.

tempSensor.C and tempSensor.F are properties of the tempSensor analog object. tempSensor.C converts the raw value to Celsius, tempSensor.F converts the raw value to Fahrenheit.

Examples

Thermometer using Fahrenheit

onBoardEvent(tempSensor, "data", function(event) {
  setNumber("temperature", tempSensor.F);
});

Thermometer using Celsius

onBoardEvent(tempSensor, "data", function(event) {
  setNumber("temperature", tempSensor.C);
});

Found a bug in the documentation? Let us know at documentation@code.org