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.
Diff: main.cpp
- Revision:
- 0:00e9a2a6f73a
- Child:
- 1:e7d2231abccc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Jun 29 17:25:06 2018 +0000 @@ -0,0 +1,18 @@ +#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 + } +} \ No newline at end of file