Guest User

Contador de Pulsos

a guest
Aug 22nd, 2020
280
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. Desenvolvido por Duds Tecnologia
  3. */
  4.  
  5. int contador = 0;
  6. bool inativo = false;
  7.  
  8. void setup() {
  9.   Serial.begin(9600);
  10. }
  11.  
  12. void loop() {
  13.   int leitura = digitalRead(2);
  14.  
  15.   if (!leitura && inativo) {
  16.     contador++;
  17.     inativo = false;
  18.   }
  19.  
  20.   if (!inativo && leitura) {
  21.     inativo = true;
  22.   }
  23.  
  24.   Serial.print("Contador: ");
  25.   Serial.println(contador);
  26. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×