Du weißt schon, dass der Wemos ein ESP ist und damit ein komplett anderes System mit anderen Pins ist.
Zeige mal deinen Sketch und dein Schaltbild, wie du es am Wemos angeschlossen hast.
Wenn alles richtig ist funktioniert es auch am Wemos allerdings nur mit einer funktionierenden Library.
#include <SoftwareSerial.h>
#include <DFRobotDFPlayerMini.h> // download this library from Arduino IDE "Manage Libraries"
int pirPin = 2; // Arduino pin the PIR sensor is connected to
int rxPin = 3; // Arduino pin the TX pin of mp3 player is connected to
int txPin = 4; // Arduino pin the RX pin of mp3 player is connected to
int motionStatus = 0; // variable to store the PIR's current reading (high or low)
int pirState = 0; // variable to store the PIR's state change
SoftwareSerial fxSerial (rxPin, txPin); // Software Serial object
DFRobotDFPlayerMini fxPlayer;
void setup() {
pinMode(pirPin, INPUT); // set Arduino pin that PIR is connected to as an INPUT
pinMode(rxPin, INPUT); // set Arduino pin that mp3 player TX is connected to as an INPUT
pinMode(txPin, OUTPUT); // set Arduino pin that mp3 player RX is connected to as an OUTPUT
Serial.begin(9600); // initialize Serial Monitor (for looking at PIR readings)
fxSerial.begin(9600); // initialize Serial communication for mp3 player
fxPlayer.begin(fxSerial); // tells mp3 player to use fxSerial for communication
fxPlayer.volume(16); // mp3 player volume (pick a value 10-30)
delay(0); // allow 30-60 secs for PIR sensor to calibrate before proceeding with sketch
}
void loop() {
motionStatus = digitalRead(pirPin); // read the PIR pin's current output (is it HIGH or LOW?)
// if PIR pin output is HIGH:
if (motionStatus == HIGH) {
if (pirState == LOW) {
Serial.println("Motion Detected"); // print result to the serial monitor
pirState = HIGH; // update the previous PIR state to HIGH
fxPlayer.play(random (1,5)); // play track 1 from micro SD card
delay(5000); // length in microseconds of the track
}
}
// or else if PIR pin output is LOW:
else {
if (pirState == HIGH) {
Serial.println ("Motion Ended"); //print result to the serial monitor
pirState = LOW; // update the previous PIR state to LOW
}
}
}
#include <DFRobotDFPlayerMini.h> // download this library from Arduino IDE "Manage Libraries"
#include <SoftwareSerial.h>
int pirPin = 7; // Arduino pin the PIR sensor is connected to
int rxPin = 6; // Arduino pin the TX pin of mp3 player is connected to
int txPin = 5; // Arduino pin the RX pin of mp3 player is connected to
int motionStatus = 0; // variable to store the PIR's current reading (high or low)
int pirState = 0; // variable to store the PIR's state change
int track = 1;
SoftwareSerial fxSerial (rxPin, txPin); // Software Serial object
DFRobotDFPlayerMini fxPlayer;
void setup() {
pinMode(pirPin, INPUT); // set Arduino pin that PIR is connected to as an INPUT
pinMode(rxPin, INPUT); // set Arduino pin that mp3 player TX is connected to as an INPUT
pinMode(txPin, OUTPUT); // set Arduino pin that mp3 player RX is connected to as an OUTPUT
Serial.begin(9600); // initialize Serial Monitor (for looking at PIR readings)
fxSerial.begin(9600); // initialize Serial communication for mp3 player
fxPlayer.begin(fxSerial); // tells mp3 player to use fxSerial for communication
fxPlayer.volume(16); // mp3 player volume (pick a value 10-30)
delay(0); // allow 30-60 secs for PIR sensor to calibrate before proceeding with sketch
}
void loop() {
motionStatus = digitalRead(pirPin); // read the PIR pin's current output (is it HIGH or LOW?)
// if PIR pin output is HIGH:
if (motionStatus == HIGH) {
if (pirState == LOW) {
Serial.println("Motion Detected"); // print result to the serial monitor
pirState = HIGH; // update the previous PIR state to HIGH
fxPlayer.play(random (1,6)); // zufall
delay(5000); // length in microseconds of the track
}
}
// or else if PIR pin output is LOW:
else {
if (pirState == HIGH) {
Serial.println ("Motion Ended"); //print result to the serial monitor
pirState = LOW; // update the previous PIR state to LOW
}
}
}