Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
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
}
}