You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reads a pulse (either HIGH or LOW) on a pin. For example, if *value* is *HIGH*, `pulseIn()` waits for the pin to go *HIGH*, starts timing, then waits for the pin to go *LOW* and stops timing. Returns the length of the pulse in microseconds. Gives up and returns 0 if no pulse starts within a specified time out.
20
+
=== Descrição
21
+
Captura a duração de um pulso em um pino (que pode ser HIGH ou LOW). Por exemplo, se o valor *HIGH* é passado para a função, a função `pulseIn()` espera o pino ir para o estado *HIGH*, começa a temporizar, então espera o pino ir para o estado *LOW* e para de temporizar. Retorna o tamanho do pulso em microssegundos. Desiste e retorna 0 se não receber nenhum pulso, caso um _timeout_ seja especificado.
22
22
23
-
The timing of this function has been determined empirically and will probably show errors in longer pulses. Works on pulses from 10 microseconds to 3 minutes in length.
23
+
A temporização dessa função foi determinada empiricamente e irá provavelmente mostrar erros em pulsos mais longos. funciona em pulsos de 10 microssegundos a 3 minutes de duração.
24
24
[%hardbreaks]
25
25
26
26
27
27
[float]
28
-
=== Syntax
29
-
`pulseIn(pin, value)`
28
+
=== Sintaxe
29
+
`pulseIn(pino, valor)`
30
30
31
-
`pulseIn(pin, value, timeout)`
31
+
`pulseIn(pino, valor, timeout)`
32
32
33
33
[float]
34
-
=== Parameters
35
-
`pin`: the number of the pin on which you want to read the pulse. (int)
34
+
=== Parâmetros
35
+
`pino`: o número do pino no qual se quer capturar a duração de um pulso. (int)
36
36
37
-
`value`: type of pulse to read: either link:../../../variables/constants/constants/[HIGH] or link:../../../variables/constants/constants/[LOW]. (int)
37
+
`valor`: tipo de pulso a ser lido: pode ser link:../../../variables/constants/constants/[HIGH] ou link:../../../variables/constants/constants/[LOW]. (int)
38
38
39
-
`timeout` (optional): the number of microseconds to wait for the pulse to start; default is one second (unsigned long)
39
+
`timeout` (opcional): o numero de microssegundos a se esperar pelo começo do pulso; o padrão é um segundo (unsigned long)
40
40
[float]
41
-
=== Returns
42
-
the length of the pulse (in microseconds) or 0 if no pulse started before the timeout (unsigned long)
41
+
=== Retorna
42
+
a duração do pulso (em microssegundos) ou 0 se nenhum pulso começar antes de se esgotar o timeout (unsigned long)
43
43
44
44
--
45
45
// OVERVIEW SECTION ENDS
@@ -52,23 +52,23 @@ the length of the pulse (in microseconds) or 0 if no pulse started before the ti
52
52
--
53
53
54
54
[float]
55
-
=== Example Code
55
+
=== Código de Exemplo
56
56
// Describe what the example code is all about and add relevant code ►►►►► THIS SECTION IS MANDATORY ◄◄◄◄◄
57
-
The example calculated the time duration of a pulse on pin 7.
57
+
O exemplo abaixo calcula a duração de um pulso no pino 7.
58
58
59
59
[source,arduino]
60
60
----
61
-
int pin = 7;
62
-
unsigned long duration;
61
+
int pin = 7; //pino para a entrada do pulso
62
+
unsigned long duration; //variável para guardar a duração do pulso
63
63
64
64
void setup()
65
65
{
66
-
pinMode(pin, INPUT);
66
+
pinMode(pin, INPUT); // pino 7 como entrada
67
67
}
68
68
69
69
void loop()
70
70
{
71
-
duration = pulseIn(pin, HIGH);
71
+
duration = pulseIn(pin, HIGH); //mede a duração de um pulso HIGH no pino 7
0 commit comments