Relay with arduino, string lighting

Thread Starter

Brinamo

Joined Mar 29, 2021
42
Ok, as now i have this sorted, looking to add DF MP3 player to the mix. Not yet got the code for that.
Also like to go further, also to add an IR remote to the mix also, if find the coding's out, would someone be good enough co mix it in with the above? Know asking a lot, but this project taken a while to do. This is the biggest brain hurt.
Regards
 

Thread Starter

Brinamo

Joined Mar 29, 2021
42
Ok, as now i have this sorted, looking to add DF MP3 player to the mix. Not yet got the code for that.
Also like to go further, also to add an IR remote to the mix also, if find the coding's out, would someone be good enough co mix it in with the above? Know asking a lot, but this project taken a while to do. This is the biggest brain hurt.
Regards
Hmm think this be the code for the DF player. Not interested in pause, stop, just one MP3 file in a loop, just to control volume up and down
Thanks
Code:
//-----------------------------------------------------------------------
//DFPlayer: Mini mp3 Player
//Library by: Angelo qiao: https://github.com/DFRobot/DFRobotDFPlayerMini
//-----------------------------------------------------------------------
#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"
//---------------------------------------------------
SoftwareSerial softwareSerial(10, 11);
DFRobotDFPlayerMini player;
//===========================================================
void setup()
{
  pinMode(2,INPUT); pinMode(3,INPUT); pinMode(4,INPUT);
  pinMode(5,INPUT); pinMode(6,INPUT); pinMode(7,INPUT);
  pinMode(9,OUTPUT);
  //---------------------------------------------------
  softwareSerial.begin(9600);
  player.begin(softwareSerial);
}
//===========================================================
void loop()
{
  if(digitalRead(5) == HIGH) player.volumeUp();
  if(digitalRead(6) == HIGH) player.volumeDown();
  //---------------------------------------------------
  if(digitalRead(2) == HIGH)
  {
    delay(200); player.next();
  }
  //---------------------------------------------------
  if(digitalRead(3) == HIGH)
  {
    delay(200); player.previous();
  }
  //---------------------------------------------------
  if(digitalRead(4) == HIGH)
  {
    delay(200);
    digitalWrite(9, HIGH);
    while(1)
    {
      player.pause();
      if(digitalRead(4) == HIGH) {player.start(); break;}
    }
    digitalWrite(9, LOW);
  }
}
 

Thread Starter

Brinamo

Joined Mar 29, 2021
42
Good things come to those who wait and look. :)

Ron
Aye, Starting to get how its structured. But still way ofer ones head to start even programming, but taking other examples and playing. Had a IR module lying about, give a go, managed to get couple things programmed to turn on off with tv remote.
Hmm Know its a big ask and doubt anyone would. But if get each device working, to how sort of want it, in individual sketches. Could then be good enough to compile into one?
Thanks
 

Thread Starter

Brinamo

Joined Mar 29, 2021
42
Anyways had a reality check, not knowing anything much about this stuff, got lights working how i wanted.
Spent over a week aye on 24/7. The rest not really needed, as all be setup once in place, so what if have to get up and turn volume up or down. As from most forums, dont get the help as one would have expected. So will still be learning this stuff, but spend more time on what i do best my magic. Rather disappointing to be honest.. Anyways best wishes to all that taken time out to reply.
 
Top