SHARE
TWEET

El borrachin

CreadPag Nov 25th, 2017 (edited) 92 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "Arduino.h"
  2. #include "SoftwareSerial.h"
  3. #include "DFRobotDFPlayerMini.h"
  4.  
  5.  
  6. int lectura=0;
  7. static unsigned long timer = millis();
  8. const int Rx = 10; // Pin10 -> RX,
  9. const int Tx = 11; // Pin11 -> TX
  10. SoftwareSerial mySerial(Rx,Tx); // conectar Tx de Arduino con Rx del modulo y viceversa
  11. DFRobotDFPlayerMini myMP3;
  12.  
  13. void setup() {
  14.  mySerial.begin(9600);
  15.  Serial.begin(9600);
  16.  
  17.  if (!myMP3.begin(mySerial)) { //
  18.  }
  19.      myMP3.volume(30); // Set volumen (0~30).
  20.      myMP3.EQ(DFPLAYER_EQ_ROCK);
  21.      myMP3.outputDevice(DFPLAYER_DEVICE_SD);
  22. }
  23. void loop() {
  24.   lectura=analogRead(A0);
  25.   Serial.println(lectura);
  26.  
  27.   if (lectura>300){
  28.      if (millis() - timer > 10000) {
  29.       timer = millis();
  30.       myMP3.play(1);  
  31.       Serial.println ("estas en pedo");
  32.       delay(20000);
  33.      }
  34.     }
  35.   }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top