Skip to content

Translated pulseIn() function #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 30, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions Language/Functions/Advanced IO/pulseIn.adoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: pulseIn()
categories: [ "Functions" ]
subCategories: [ "Advanced I/O" ]
subCategories: [ "Entradas e Saídas Avançadas" ]
---

:source-highlighter: pygments
Expand All @@ -17,29 +17,29 @@ subCategories: [ "Advanced I/O" ]
--

[float]
=== Description
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.
=== Descrição
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.

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.
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.
[%hardbreaks]


[float]
=== Syntax
`pulseIn(pin, value)`
=== Sintaxe
`pulseIn(pino, valor)`

`pulseIn(pin, value, timeout)`
`pulseIn(pino, valor, timeout)`

[float]
=== Parameters
`pin`: the number of the pin on which you want to read the pulse. (int)
=== Parâmetros
`pino`: o número do pino no qual se quer capturar a duração de um pulso. (int)

`value`: type of pulse to read: either link:../../../variables/constants/constants/[HIGH] or link:../../../variables/constants/constants/[LOW]. (int)
`valor`: tipo de pulso a ser lido: pode ser link:../../../variables/constants/constants/[HIGH] ou link:../../../variables/constants/constants/[LOW]. (int)

`timeout` (optional): the number of microseconds to wait for the pulse to start; default is one second (unsigned long)
`timeout` (opcional): o numero de microssegundos a se esperar pelo começo do pulso; o padrão é um segundo (unsigned long)
[float]
=== Returns
the length of the pulse (in microseconds) or 0 if no pulse started before the timeout (unsigned long)
=== Retorna
a duração do pulso (em microssegundos) ou 0 se nenhum pulso começar antes de se esgotar o timeout (unsigned long)

--
// OVERVIEW SECTION ENDS
Expand All @@ -52,23 +52,23 @@ the length of the pulse (in microseconds) or 0 if no pulse started before the ti
--

[float]
=== Example Code
=== Código de Exemplo
// Describe what the example code is all about and add relevant code ►►►►► THIS SECTION IS MANDATORY ◄◄◄◄◄
The example calculated the time duration of a pulse on pin 7.
O exemplo abaixo calcula a duração de um pulso no pino 7.

[source,arduino]
----
int pin = 7;
unsigned long duration;
int pin = 7; //pino para a entrada do pulso
unsigned long duration; //variável para guardar a duração do pulso

void setup()
{
pinMode(pin, INPUT);
pinMode(pin, INPUT); // pino 7 como entrada
}

void loop()
{
duration = pulseIn(pin, HIGH);
duration = pulseIn(pin, HIGH); //mede a duração de um pulso HIGH no pino 7
}
----
[%hardbreaks]
Expand Down