8000 Adding documentation for NXT Temperature Sensor · ev3dev-lang-java/docs@3721ffa · GitHub
[go: up one dir, main page]

Skip to content

Commit 3721ffa

Browse files
committed
Adding documentation for NXT Temperature Sensor
1 parent 315c79a commit 3721ffa

File tree

5 files changed

+56
-1
lines changed

5 files changed

+56
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ build
55

66

77

8+

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.1-all.zip
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import ev3dev.sensors.nxt.NXTTemperatureSensor;
2+
import java.util.stream.IntStream;
3+
import lejos.hardware.port.SensorPort;
4+
import lejos.robotics.SampleProvider;
5+
import lombok.extern.slf4j.Slf4j;
6+
7+
@Slf4j
8+
public class NXTTemperatureSensorDemo {
9+
10+
public static void main(String[] args) {
11+
12+
NXTTemperatureSensor temp1 = new NXTTemperatureSensor(SensorPort.S1);
13+
14+
final SampleProvider sp = temp1.getCelsiusMode();
15+
float [] sample = new float[sp.sampleSize()];
16+
17+
IntStream.range(1,10).boxed()
18+
.map(i -> {
19+
sp.fetchSample(sample, 0);
20+
return sample[0];
21+
})
22+
.forEach(temp -> LOGGER.info("Temperature: {}", temp));
23+
}
24+
25+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# NXT Temperature Sensor
2+
3+
## Introduction
4+
5+
Temperature is a physical quantity that expresses hot and cold. It is the manifestation of thermal energy,
6+
present in all matt 8000 er, which is the source of the occurrence of heat, a flow of energy,
7+
when a body is in contact with another that is colder or hotter.
8+
9+
Temperature is measured with a thermometer.
10+
Thermometers are calibrated in various temperature scales that historically have used various reference points
11+
and thermometric substances for definition.
12+
The most common scales are the Celsius scale (formerly called centigrade, denoted as °C),
13+
the Fahrenheit scale (denoted as °F), and the Kelvin scale (denoted as K), the last of which is predominantly
14+
used for scientific purposes by conventions of the International System of Units (SI).
15+
16+
You could connect this sensor to the brick to retrieve the Temperature.
17+
18+
image:temperature-sensor.jpg[image]
19+
20+
## How to use the sensor
21+
22+
[source,java]
23+
----
24+
include::NXTTemperatureSensorDemo.java[]
25+
----
26+
27+
References:
28+
29+
- https://en.wikipedia.org/wiki/Temperature
Loading

0 commit comments

Comments
 (0)
0