José Neto / Mbed 2 deprecated ProjetoFinal

Dependencies:   mbed-rtos mbed

main.cpp

Committer:
zeneto
Date:
2018-06-29
Revision:
0:00e9a2a6f73a
Child:
1:e7d2231abccc

File content as of revision 0:00e9a2a6f73a:

#include "mbed.h"

const int pushButton = 16;
const int buzzer = 1;

void setup() {
    pinMode(pushButton, INPUT); //DEFINE A PORTA COMO ENTRADA
    pinMode(buzzer, OUTPUT); //DEFINE A PORTA COMO SAÍDA
}
void loop(){
leitura = digitalRead(pushButton); //LÊ O VALOR NA PORTA DIGITAL E ARMAZENA NA VARIÁVEL
 
  if(leitura == 0){ //SE O VALOR LIDO FOR IGUAL A 0, FAZ
      digitalWrite(buzzer, HIGH); //LED ACESO
  }else{ //SENÃO, FAZ
    digitalWrite(buzzer, LOW); //LED APAGADO
  }
}