File tree 2 files changed +6
-2
lines changed
Language/Functions/Advanced IO
2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ the length of the pulse (in microseconds) or 0 if no pulse started before the ti
53
53
[float]
54
54
=== Example Code
55
55
// Describe what the example code is all about and add relevant code ►►►►► THIS SECTION IS MANDATORY ◄◄◄◄◄
56
- The example calculated the time duration of a pulse on pin 7.
56
+ The example prints the time duration of a pulse on pin 7.
57
57
58
58
[source,arduino]
59
59
----
@@ -62,12 +62,14 @@ unsigned long duration;
62
62
63
63
void setup()
64
64
{
65
+ Serial.begin(9600);
65
66
pinMode(pin, INPUT);
66
67
}
67
68
68
69
void loop()
69
70
{
70
71
duration = pulseIn(pin, HIGH);
72
+ Serial.println(duration);
71
73
}
72
74
----
73
75
[%hardbreaks]
Original file line number Diff line number Diff line change @@ -55,19 +55,21 @@ the length of the pulse (in microseconds) or 0 if no pulse started before the ti
55
55
[float]
56
56
=== Example Code
57
57
// Describe what the example code is all about and add relevant code ►►►►► THIS SECTION IS MANDATORY ◄◄◄◄◄
58
- The example calculated the time duration of a pulse on pin 7.
58
+ The example prints the time duration of a pulse on pin 7.
59
59
60
60
[source,arduino]
61
61
----
62
62
int pin = 7;
63
63
unsigned long duration;
64
64
65
65
void setup() {
66
+ Serial.begin(9600);
66
67
pinMode(pin, INPUT);
67
68
}
68
69
69
70
void loop() {
70
71
duration = pulseInLong(pin, HIGH);
72
+ Serial.println(duration);
71
73
}
72
74
----
73
75
[%hardbreaks]
You can’t perform that action at this time.
0 commit comments