@will no the dfplayer doesn't play it just flashes but no sound but if i go to reprogram the arduino it starts playing lol or if i hit the reset on the nano it starts to play or if i unplug it starts to play
[URL=https://datesnow.life]Verified Maidens[/URL]
@ozyjimbo
Interesting, how about the LEDs, do they work as you intended ?
Double check that you're not getting the message "DFPlayer error" or comment out the "while (true) {};" line. It may be that it's hanging on that.
Anything seems possible when you don't know what you're talking about.
@will the lights come on but still don't turn off lol yes i did do the comment out while true but still no benefit i'll take a vid on the next attempt i didn't want the mpplayer flashing for to long to see how long it took for the lights to turn off it seems as they mpplayer starts playing on an interupt
[URL=https://datesnow.life]Verified Maidens[/URL]
@ozyjimbo
Try putting a pixels.show(); after the pixels.clear(); Maybe clear just sets them to black but doesn't force a refresh.
Anything seems possible when you don't know what you're talking about.
@will no matter what i do what i change doesn't seem to have any impact
[URL=https://datesnow.life]Verified Maidens[/URL]
@ozyjimbo
I don't know what I'm listening to but I hear sound all the way through. Is that the MP3 player ?
The lights are programmed to stay on for 90 seconds which is longer than the tape, so they never had a chance to turn off. Maybe you should shorten the delay from 90000 to 5000 for testing.
What pin are you connecting and disconnecting while the sketch is running ?
Anything seems possible when you don't know what you're talking about.
@will nahh thats the monther in law watching youtube i diconnected the rx pin as like i said if it's interrupted the mpplayer will start to play i'll play it again and drop the time and see if the lightys turn off
[URL=https://datesnow.life]Verified Maidens[/URL]
after changing the millis from 90000 to 90 allowed the mpplayer to start normal but after the mp3 finishes the lights still remain on lol the only thing the millis is affecting is the mpplayer and not the lights as they are still staying on
[URL=https://datesnow.life]Verified Maidens[/URL]
@ozyjimbo
Briefing I'm trying to make a sketch using arduino nano, dfplayer, neopixels and pir sensor the wiring is standard rx and tx to 10,11 pir pin 2 neopixels 5
object is to have the pixels come on when the dfplayer is triggered by the pir sensor and turn off after the mp3 player has finished playing.
what I have achieved as a beginner is what some of the pros would call a Frankenstein sketch comprising bits of other sketches and my lack and ability to write my own code I'm code semi illiterate. However that being said I have been at this for days not only trying to get it working but reading and trying other sketches and parts to the point I just have to now ask for a little help.
my sketch is partly working I can get the dfplayer to play I can get the lights to turn on the dfplayer starts as soon as it powered and after it's played you can trigger it with the pir however the lights come on but stay on i have attached the sketch if anyone can help it would be greatly appreciated.
Hi ozyjimbo,
Some observations:
- You have declared two variables to monitor elapsed time using the millis() function:
unsigned int Millis = 0;
unsigned int Millis_previous = 0;
Assuming your compiler resolves these integers as 16 bit variables then these will each have a max value of 64k before cycling back to 0, ie just over a minute of elapsed time before cycling back around. Is this what yoy realy want? Such variables are normally defined as follows:
uint32_t Millis = 0;
uint32_t Millis_previous = 0;
that is as 32 bit unsigned variables which will recycle after around 49 days!
- From my distant memory in playing around with PIRs is that these components stay on for a short time when triggered even after no movement is detected. This time is often varied by a pot on the PIR board. Is this likely to be the issue?
Anyway, just some immediate observations.
Regards
Ron B
Ron Bentley
Creativity is an input to innovation and change is the output from innovation. Braden Kelley
A computer is a machine for constructing mappings from input to output. Michael Kirby
Through great input you get great output. RZA
Gauss is great but Euler rocks!!
@ronbentley1 you are right i have got the pot fully turned for the "5min" i have both files seperate and both function how they should it's only when i'm trying to join them into the one script is where it starts to play up so then i found another script to Frankenstein from and got it to the point of my original ino post above in ref to the 0 millis i put it to 0 in my testing to which i made a reply that the millis in the v2 made by will only affected the mpplayer and the greater the number the mpplayer wouldn't play as per video and setting it to 0 the mpplayer played as normal
[URL=https://datesnow.life]Verified Maidens[/URL]
@ozyjimbo
What about your elapsed timer variables? Are you happy these are 32 bit and not 16 bit?
Ron B
Ron Bentley
Creativity is an input to innovation and change is the output from innovation. Braden Kelley
A computer is a machine for constructing mappings from input to output. Michael Kirby
Through great input you get great output. RZA
Gauss is great but Euler rocks!!
@ronbentley1 are you referring to the original ino no as i don't know what your talking about all that part came from another sketch that worked that i could just take what i needed out remember i'm code illiterate and yes i'm batting above my experience level lol but in v2 made by Will had the very same difficulties as my original
[URL=https://datesnow.life]Verified Maidens[/URL]
@ozyjimbo
Ok, try making this change:
From
unsigned int Millis = 0;
unsigned int Millis_previous = 0;
To
uint32_t Millis = 0;
uint32_t Millis_previous = 0;
Give it a try, nothing to lose.
Regards
Ron B
Ron Bentley
Creativity is an input to innovation and change is the output from innovation. Braden Kelley
A computer is a machine for constructing mappings from input to output. Michael Kirby
Through great input you get great output. RZA
Gauss is great but Euler rocks!!
@ozyjimbo
The sketch you posted.
The length of an integer (int) depends on the architecture of the board being used. An int type variable can be 16, 32 or even 64 bits in size. If using millis then 32 bit integers are most commonly used.
Ron B
Ron Bentley
Creativity is an input to innovation and change is the output from innovation. Braden Kelley
A computer is a machine for constructing mappings from input to output. Michael Kirby
Through great input you get great output. RZA
Gauss is great but Euler rocks!!
@ronbentley1 yup understand i tried your recommendation and still no luck so i scrapped it and edited a sketch i made for just the lights so have been playing around with it to try and get the mpplayer to play in that i thought it would be as easy to insert it under the pir and well it kinda does work it just flashes the mpplayer without playing however if i place the mpplayer in setup it runs fine but the issue there is it wont trigger with the pir i'll include the ino if you want to take a look if all else fails i'll just have to rig a relay to the mpplayer so when the pir triggers it will send 5v to the mpplayer to start instead of it being in the loop
[URL=https://datesnow.life]Verified Maidens[/URL]