Arduino_MKRENV - readTemperature()

Read the temperature sensor’s value. If no unit is specified as parameter, the value will be expressed in Celsius.

Syntax

ENV.readTemperature(unit)

Parameters

  • unit: FAHRENHEIT to get the temperature in Fahrenheit and CELSIUS to get the temperature in Celsius (default).

Returns

The sensor’s temperature value as float in the specified unit.

Example

Serial.print("Temperature = ");
Serial.print(ENV.readTemperature());
Serial.println(" °C");

See also