Skip to content

Instantly share code, notes, and snippets.

@mpflaga
mpflaga / strstrSerial.ino
Last active August 29, 2015 14:05
Example of looking for specific text from serial input stream
char buffer[5];
#define buffer_size sizeof(buffer)/sizeof(buffer[0])
int8_t buffer_pos = 0;
void setup() {
//Initialize serial and wait for port to open:
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
@mpflaga
mpflaga / FilePlayer.ino
Created November 23, 2014 15:28
FilePlayer.ino, tweaked to allow space for Leo build.
/**
* \file FilePlayer.ino
*
* \brief Example sketch of using the MP3Shield Arduino driver, with flexible list of files and formats
* \remarks comments are implemented with Doxygen Markdown format
*
* \author Bill Porter
* \author Michael P. Flaga
*
* This sketch listens for commands from a serial terminal (such as the Serial
@mpflaga
mpflaga / DirectDriveLED_CSM58261EG.ino
Last active August 29, 2015 14:10
Arduino sketch to directly drive the pins of a CSM58261EG 8x5 Red/Green LED Matrix
/*
* Show messages on an 8x5 led matrix,
* scrolling from right to left.
*
* Uses FrequencyTimer2 library to
* constantly run an interrupt routine
* at a specified frequency. This
* refreshes the display without the
* main loop having to do anything.
*
@mpflaga
mpflaga / TrackPlayer.ino
Last active December 16, 2015 00:49
This sketch listens for commands from a serial terminal (such as the Serial Monitor in the Arduino IDE). Listening for either a single character menu commands or an numeric strings of an index. This sketch allows the various file formats to be played: mp3, aac, wma, wav, fla & mid. This sketch behaves nearly identical to MP3Shield_Library_Demo.i…
/**
* \file TrackPlayer.ino
*
* \brief Example sketch of using the MP3Shield Arduino driver
* \remarks comments are implemented with Doxygen Markdown format
*
* \author Bill Porter
* \author Michael P. Flaga
*
* This sketch listens for commands from a serial terminal (such as the Serial
@mpflaga
mpflaga / FileNamePlayer.ino
Last active December 16, 2015 00:59
This sketch listens for commands from a serial terminal which are TERMINATED with New Line Feeds (aka "\n" or 0xA). To use this sketch enable Serial Monitor to use NewLine's. If the Serial message is 1 byte in length and terminated by LF, the byte will be processed as menu command. If the Serial Message is larger than 1 byte it will assumed a Fi…
/**
* \file FileNamePlayer.ino
*
* \brief Example sketch of using the MP3Shield Arduino driver
* \remarks comments are implemented with Doxygen Markdown format
*
* \author Michael P. Flaga
*
* This sketch listens for commands from a serial terminal which are TERMINATED
* with New Line Feeds (aka "\n" or 0xA). To use this sketch enable Serial
// libraries
#include <SPI.h>
#include <SdFat.h>
#include <SdFatUtil.h>
#include <SFEMP3Shield.h>
// initialize MP3 card
SdFat sd;
SFEMP3Shield MP3player;
// constant variables
@mpflaga
mpflaga / MP3ButtonPlayer.ino
Last active December 21, 2015 23:29
Short Example of how to use Bounce Library to control SFEMP3Shield library
/**
* \file MP3ButtonPlayer.ino
*
* \brief Example sketch of using the MP3Shield Arduino driver using buttons,
* with improved debounce library
* \remarks comments are implemented with Doxygen Markdown format
*
* \author Michael P. Flaga
*
* This sketch demonstrates the use of digital input pins used as buttons as
@mpflaga
mpflaga / MP3sequence.ino
Last active February 10, 2016 16:09
Simple example of playing a sequence of tracks.
// libraries
#include <SPI.h>
#include <SdFat.h>
#include <SdFatUtil.h>
#include <SFEMP3Shield.h>
// initialize MP3 card
SdFat sd;
SFEMP3Shield MP3player;
byte result; // variable for mp3 player shield, can be used to debug
@mpflaga
mpflaga / froggy14_MP3_PIR.ino
Last active February 10, 2016 16:12
Froggy14's code with corrections as to allow it to get compiled.
// libraries
#include <SPI.h>
#include <SdFat.h>
#include <SdFatUtil.h>
#include <SFEMP3Shield.h>
// initialize MP3 card
SdFat sd;
SFEMP3Shield MP3player;
#include <EasyTransfer.h>
#define LENGTH_OF_ARRAY(x)((sizeof(x) / sizeof(x[0])))
//create object
EasyTransfer ET;
struct SEND_DATA_STRUCTURE {
//put your variable definitions here for the data you want to send
//THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO
int arraydata[5];