KeyDuino forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.


Un échange d'information autour de la carte KeyDuino
 
HomeHome  Latest imagesLatest images  RegisterRegister  Log inLog in  

 

 Personal Sound Track Music Box

Go down 
2 posters
AuthorMessage
Andriod
beginner
beginner



Messages : 18
Reputation : 0
Date d'inscription : 2016-03-20

Personal Sound Track Music Box Empty
PostSubject: Personal Sound Track Music Box   Personal Sound Track Music Box EmptySun 27 Mar - 21:39

My plan here is to have a Keyduino and an MP3 player hidden in a box near my front door. When myself, my wife, or other regular guests enter we can scan the NFC either in our phone or an NFCRing it will start playing a song we've previously selected and placed on the MicroSD card.

The trick is making this easy enough to maintain, so I'm planning to record any tag scanned so that we can figure out what the ID is easily and set the song for a new tag. Further extensions would be to make this the front door tag of a smart home system--but I really intend to use GPS for that.
Back to top Go down
MrStein
KeyDuino TEAM
MrStein


Messages : 85
Reputation : 4
Date d'inscription : 2015-10-10
Age : 30
Localisation : Lille, FRANCE

Personal Sound Track Music Box Empty
PostSubject: Re: Personal Sound Track Music Box   Personal Sound Track Music Box EmptySat 9 Apr - 15:13

Wo, cool Smile we make a simular project (you can see it on the kickstarter video) with LED effect.
Here is the code:

Code:
#include "KeyDuino.h"
#include <SPI.h>
#include <SdFat.h>
#include <SdFatUtil.h>
#include <SFEMP3Shield.h>


KeyDuino keyDuino;

String NFC_KEY_1 = "xxxxxxxxxxxx";
String NFC_KEY_2 = "xxxxxxxxxxxx";

uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 };
uint8_t uidLength;

SdFat sd;
SFEMP3Shield MP3player;

int8_t current_track = 1;

void setup() {
  Serial.begin(115200);
  keyDuino.begin();

  if (!sd.begin(9, SPI_HALF_SPEED)) sd.initErrorHalt();
  if (!sd.chdir("/")) sd.errorHalt("sd.chdir");
  MP3player.begin();
  MP3player.setVolume(10, 10);

  Serial.println("KeyDuino SOUND is ready, please scan a NFC tag");
}


void loop() {
  uint8_t success;
  String readID;
  success = keyDuino.readTargetID(uid, &uidLength);
  if (success) {
    if (readID == NFC_KEY_1) MP3player.playTrack(1);
    else if (readID == NFC_KEY_1) MP3player.playTrack(2);
    else  MP3player.stopTrack();
  }
}

Keep us in touch for your project!
Back to top Go down
https://keyduino.forumsactifs.com
 
Personal Sound Track Music Box
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
KeyDuino forum :: KeyDuino projects & tutorial :: Projects :: WIP projets-
Jump to: