Advertisement
Guest User

Untitled

a guest
Nov 8th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Wtv020sd16p.h>
  2. int REED = 2;
  3. int valor;
  4.  
  5. //MUDANCAS GUI
  6. int resetPin = 4;  //Pino Reset
  7. int clockPin = 5;  //Pino clock
  8. int dataPin = 6;   //Pino data (DI)
  9. int busyPin = 7;   //Pino busy
  10. Wtv020sd16p wtv020sd16p(resetPin,clockPin,dataPin,busyPin);
  11. //MUDANCAS GUI
  12.  
  13.  
  14. void setup() {
  15.   Serial.begin(9600);
  16.  
  17.   pinMode(REED, INPUT);
  18.   wtv020sd16p.reset();
  19. }
  20.  
  21. void loop() {
  22.   while(Serial.available() > 0){
  23.     valor = digitalRead(REED);
  24.     Serial.println(valor);
  25.    
  26.     if (valor == HIGH){
  27.       //SE ENTROU AQUI SIGNIFICA QUE O SENSOR FOI ACIONADO
  28.  
  29.       //REPRODUZIR SOM
  30.       Serial.println("SOM");
  31.       wtv020sd16p.playVoice(0);
  32.       //Reproduz o arquivo de som
  33.       wtv020sd16p.asyncPlayVoice(1);
  34.       delay(3000);
  35.       wtv020sd16p.stopVoice();
  36.       delay(2000);
  37.      
  38.      
  39.     } else {
  40.       //SAIU
  41.     }
  42.  
  43.   }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement