tempSensor
is an object that represents the analog temperature sensor at pin A0.
This sensor reads the temperature in the room, the data on this can be found with tempSensor.value
. You can convert the value to something easier to understand with the .C
(Celsius) and .F
(Fahrenheit) properties. Temperature results will vary from board to board.
Properties and Methods
tempSensor.C
is a property of tempSensor that converts the raw value into Celsius. tempSensor.F
is a property of tempSensor that converts the raw value into Fahrenheit.Events
data
- Updates the current value of the tempSensor every 100 milliseconds.change
- Updates the current value of the tempSensor only when the sensor detects a change.Sets the temperature label on the screen to be the temperature of the room in Fahrenheit every 100 milliseconds using the data
event.
onBoardEvent(tempSensor, "data", function(event) { setNumber("temperature", tempSensor.F); });
tempSensor
Found a bug in the documentation? Let us know at documentation@code.org