Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wtv020sd16p.h>
- int REED = 2;
- int valor;
- //MUDANCAS GUI
- int resetPin = 4; //Pino Reset
- int clockPin = 5; //Pino clock
- int dataPin = 6; //Pino data (DI)
- int busyPin = 7; //Pino busy
- Wtv020sd16p wtv020sd16p(resetPin,clockPin,dataPin,busyPin);
- //MUDANCAS GUI
- void setup() {
- Serial.begin(9600);
- pinMode(REED, INPUT);
- wtv020sd16p.reset();
- }
- void loop() {
- while(Serial.available() > 0){
- valor = digitalRead(REED);
- Serial.println(valor);
- if (valor == HIGH){
- //SE ENTROU AQUI SIGNIFICA QUE O SENSOR FOI ACIONADO
- //REPRODUZIR SOM
- Serial.println("SOM");
- wtv020sd16p.playVoice(0);
- //Reproduz o arquivo de som
- wtv020sd16p.asyncPlayVoice(1);
- delay(3000);
- wtv020sd16p.stopVoice();
- delay(2000);
- } else {
- //SAIU
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement