Andriod beginner
Messages : 18 Reputation : 0 Date d'inscription : 2016-03-20
| Subject: Personal Sound Track Music Box Sun 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. | |
|
MrStein KeyDuino TEAM
Messages : 85 Reputation : 4 Date d'inscription : 2015-10-10 Age : 31 Localisation : Lille, FRANCE
| Subject: Re: Personal Sound Track Music Box Sat 9 Apr - 15:13 | |
| Wo, cool 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! | |
|