2.1.28, initiation update to PXT v5.28.24 (#54)
This commit is contained in:
committed by
Peli de Halleux
parent
38a964516e
commit
5c114a0c57
@@ -7,18 +7,23 @@ The @boardname@ can find the temperature nearby by checking how hot its computer
|
||||
input.temperature();
|
||||
```
|
||||
|
||||
### Returns
|
||||
## Returns
|
||||
|
||||
* a [Number](/reference/types/number) that means the Celsius temperature.
|
||||
* a [number](/types/number) that is the temperature in degrees Celsius.
|
||||
|
||||
### How does it work?
|
||||
## How does it work?
|
||||
|
||||
The @boardname@ checks how hot its CPU (main computer chip) is.
|
||||
Because the @boardname@ does not usually get very hot, the temperature of the CPU
|
||||
is usually close to the temperature of wherever you are.
|
||||
The @boardname@ might warm up a little if you make it work hard, though!
|
||||
|
||||
### Example: @boardname@ thermometer
|
||||
Learn more about how the @boardname@ can detect hot or cold in this video:
|
||||
|
||||
https://www.youtube.com/watch?v=_T4N8O9xsMA
|
||||
|
||||
|
||||
## Example: @boardname@ thermometer
|
||||
|
||||
The following example uses `temperature` and `show number` to show the temperature of the room.
|
||||
|
||||
@@ -28,31 +33,31 @@ basic.forever(() => {
|
||||
basic.showNumber(temp)
|
||||
})
|
||||
```
|
||||
### Example: Fahrenheit thermometer
|
||||
## Example: Fahrenheit thermometer
|
||||
|
||||
This program measures the temperature using Fahrenheit degrees.
|
||||
Fahrenheit is a way of measuring temperature that is commonly used in the United States.
|
||||
To make a Celsius temperature into a Fahrenheit one, multiply the Celsius temperature by
|
||||
``18``, divide by ``10`` and add ``32``.
|
||||
``1.8`` and add ``32``.
|
||||
|
||||
```blocks
|
||||
basic.forever(() => {
|
||||
let c = input.temperature()
|
||||
let f = (c * 18) / 10 + 32
|
||||
let f = (1.8 * c) + 32
|
||||
basic.showNumber(f)
|
||||
})
|
||||
```
|
||||
|
||||
### ~hint
|
||||
## ~hint
|
||||
|
||||
Try comparing the temperature your @boardname@ shows to a real thermometer in the same place.
|
||||
You might be able to figure out how much to subtract from the number the @boardname@
|
||||
shows to get the real temperature. Then you can change your program so the @boardname@ is a
|
||||
better thermometer.
|
||||
|
||||
### ~
|
||||
## ~
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[compass-heading](/reference/input/compass-heading), [acceleration](/reference/input/acceleration)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user