8000 GitHub - Chrissoka/npn_controle_de_rel-
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Chrissoka/npn_controle_de_rel-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 

Repository files navigation

lampada-npn_no_controle_de_rele

Projeto circuito de lâmpada com controle rele-npn

IMAGEM DO CIRCUITO

projeto_controle_npn_botao

CÓDIGO

C++

int pinButton = 8;
int Relay = 2;
int stateRelay = LOW;
int stateButton;
int previous = LOW;
long time = 0;
long debounce = 100;


int stayON = 5000;

void setup() {
  pinMode(pinButton, INPUT);
  pinMode(Relay, OUTPUT);
}

void loop() {
  stateButton = digitalRead(pinButton);  
  if(stateButton == HIGH && previous == LOW && millis() - time > debounce) {
    if(stateRelay == HIGH){
      digitalWrite(Relay, LOW);
    } else {


       digitalWrite(Relay, HIGH);
       delay(stayON);
       digitalWrite(Relay, LOW);
    }
    time = millis();
  }
  previous == stateButton;
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0