Introduction: LinkItOne IPod Shuffle
This is a simple project to learn about using the MediaTek LinkIt's Headphone Port to play music.
For this project you will need:
- A Solderless Bread Board
- Jumper Wires
- A Push Button Switch
- a micro SD card to save sound files
- A MediaTek LinkItOne
A huge thank you to instructables, autodesk, MediaTek, and Penolopy Bulnick for sending me the Link It One used in this instructable.
Check Out Our Other Accounts! Like, Subscribe, and Follow to keep up to date with our latest projects. :-)
Step 1: Test the Standard State of Your Switch
Usually the standard state of your switch can be found in the data
sheet. Since I salvaged this limit switch off of an old printer I made sure to test it first.
To test the switch you simply need to connect it in series with an LED and connect it to a low voltage source on the LinkIt. My switch had a standard ON state. This will become more important when you begin coding.
Step 2: Wiring
Run a jumper wire from the digital ground pin (Black), and an LED driver
pin (Red) to two rows on the board. Place the long leg of the LED into the positive row and the short leg into the ground row.
Run two jumpers from two different digital pins (one will be programmed as hot) and connect your switch between them.
The MediaTek LinkIt is designed to work with 2 or 3 wire 3.5mm microphones (Hot, Ground or Left, Right, Ground). If you are using a 4 wire pair of headphones (usually with control buttons) you may need an adapter or only partially insert the cable into the headphone Jack.
Step 3: Programming
Format a micro SD card into FAT format. Then save the files as .mp3 files directly onto the SD card.
Use the code below to trigger the sound file (replace the "001.mp3" with the name of your files)
1 = "001.mp3"
2 = "002.mp3"
3 = "003.mp3"
Have the program choose a random song.
song = random(1, 3)
When the button is pressed execute the command.
LAudio.setVolume(3); LAudio.playFile( storageSD,(char*)song)
If the button is pressed twice in rapid succession have a new random variable be chosen and another song begin to play.
For testing purposes I set the LED to light up when ever the LAudio command is executed to help with debugging. Luckily this project went smoothly and it was not necessary.
Full code files will be published once I am done debugging the code. I am currently working to expand the maximum number of songs the program can handle before crashing the LinkIt.
Step 4: Testing
To start or stop playing the music simply press the switch once.
Press the switch twice in rapid succession to skip a song.
Any suggestions or ideas are welcome in the comments.
Have a great day! :-)