Temperature sensor on the CPX
Table of contents
Temperature Sensor
The Circuit Playground Express has a temperature sensor mounted permanently to the circuit board as shown in the following image.
Reading the Temperature Sensor with Hello_Temperature
The Hello_Temperature
sketch is part of the Adafruit Circuit Playground library. You can open the sketch by selecting File –> Examples –> Adafruit Circuit Playground –> Hello_CircuitPlayground –>Hello_Temperature. Running the sketch produces temperature readings in the Serial Monitor.
Temperature Readings
Consult the source code in Hello_Temperature
to see how temperature readings are made.
There is only one temperature sensor, but the reading can be returned in either Celsius or Fahrenheit with two functions.
float TC, TF;
TC = CircuitPlayground.temperature();
TF = CircuitPlayground.temperatureF();