Difference between revisions of "Students/Ian Petrov"

From Robert-Depot
Jump to: navigation, search
 
(3 intermediate revisions by the same user not shown)
Line 42: Line 42:
 
Code
 
Code
 
----
 
----
[quote]
+
<pre>
[color=#7E7E7E]//Ian Petrov VIS147A Final[/color]
+
//Ian Petrov VIS147A Final
[color=#7E7E7E]//code edited from Adafruit Wave Shield Site[/color]
+
//code edited from Adafruit Wave Shield Site
#include <FatReader.h>
+
#include <FatReader.h>
#include <SdReader.h>
+
#include <SdReader.h>
#include <avr/pgmspace.h>
+
#include <avr/pgmspace.h>
#include [color=#006699]"WaveUtil.h"[/color]
+
#include "WaveUtil.h"
#include [color=#006699]"WaveHC.h"[/color]
+
#include "WaveHC.h"
  
  
SdReader card;    [color=#7E7E7E]// This object holds the information for the card[/color]
+
SdReader card;   // This object holds the information for the card
FatVolume vol;    [color=#7E7E7E]// This holds the information for the partition on the card[/color]
+
FatVolume vol;   // This holds the information for the partition on the card
FatReader root;   [color=#7E7E7E]// This holds the information for the filesystem on the card[/color]
+
FatReader root;   // This holds the information for the filesystem on the card
FatReader f;      [color=#7E7E7E]// This holds the information for the file we're play[/color]
+
FatReader f;     // This holds the information for the file we're play
  
WaveHC wave;      [color=#7E7E7E]// This is the only wave (audio) object, since we will only play one at a time[/color]
+
WaveHC wave;     // This is the only wave (audio) object, since we will only play one at a time
  
#define DEBOUNCE 100  [color=#7E7E7E]// button debouncer[/color]
+
#define DEBOUNCE 100  // button debouncer
  
[color=#7E7E7E]// this handy function will return the number of bytes currently free in RAM, great for debugging!   [/color]
+
// this handy function will return the number of bytes currently free in RAM, great for debugging!  
[color=#CC6600]int[/color] freeRam([color=#CC6600]void[/color])
+
int freeRam(void)
 
{
 
{
  extern [color=#CC6600]int[/color] __bss_end;  
+
  extern int  __bss_end;  
  extern [color=#CC6600]int[/color] *__brkval;  
+
  extern int  *__brkval;  
  [color=#CC6600]int[/color] free_memory;  
+
  int free_memory;  
  [color=#CC6600]if[/color](([color=#CC6600]int[/color])__brkval == 0) {
+
  if((int)__brkval == 0) {
    free_memory = (([color=#CC6600]int[/color])&free_memory) - (([color=#CC6600]int[/color])&__bss_end);  
+
    free_memory = ((int)&free_memory) - ((int)&__bss_end);  
  }
+
  }
  [color=#CC6600]else[/color] {
+
  else {
    free_memory = (([color=#CC6600]int[/color])&free_memory) - (([color=#CC6600]int[/color])__brkval);  
+
    free_memory = ((int)&free_memory) - ((int)__brkval);  
  }
+
  }
  [color=#CC6600]return[/color] free_memory;  
+
  return free_memory;  
} 
+
}  
  
[color=#CC6600]void[/color] sdErrorCheck([color=#CC6600]void[/color])
+
void sdErrorCheck(void)
 
{
 
{
  [color=#CC6600]if[/color] (!card.errorCode()) [color=#CC6600]return[/color];
+
  if (!card.errorCode()) return;
  putstring([color=#006699]"\n\rSD I/O error: "[/color]);
+
  putstring("\n\rSD I/O error: ");
  [color=#CC6600][b]Serial[/b][/color].[color=#CC6600]print[/color](card.errorCode(), [color=#006699]HEX[/color]);
+
  Serial.print(card.errorCode(), HEX);
  putstring([color=#006699]", "[/color]);
+
  putstring(", ");
  [color=#CC6600][b]Serial[/b][/color].[color=#CC6600]println[/color](card.errorData(), [color=#006699]HEX[/color]);
+
  Serial.println(card.errorData(), HEX);
  [color=#CC6600]while[/color](1);
+
  while(1);
 
}
 
}
  
[color=#CC6600]void[/color] [color=#CC6600][b]setup[/b][/color]() {
+
void setup() {
  [color=#7E7E7E]// set up serial port[/color]
+
  // set up serial port
  [color=#CC6600][b]Serial[/b][/color].[color=#CC6600]begin[/color](9600);
+
  Serial.begin(9600);
  putstring_nl([color=#006699]"WaveHC with 6 buttons"[/color]);
+
  putstring_nl("WaveHC with 6 buttons");
  
+
 
   putstring([color=#006699]"Free RAM: "[/color]);      [color=#7E7E7E]// This can help with debugging, running out of RAM is bad[/color]
+
  putstring("Free RAM: ");      // This can help with debugging, running out of RAM is bad
  [color=#CC6600][b]Serial[/b][/color].[color=#CC6600]println[/color](freeRam());      [color=#7E7E7E]// if this is under 150 bytes it may spell trouble![/color]
+
  Serial.println(freeRam());      // if this is under 150 bytes it may spell trouble!
  
+
 
  [color=#7E7E7E]// Set the output pins for the DAC control. This pins are defined in the library[/color]
+
  // Set the output pins for the DAC control. This pins are defined in the library
  [color=#CC6600]pinMode[/color](2, [color=#006699]OUTPUT[/color]);
+
  pinMode(2, OUTPUT);
  [color=#CC6600]pinMode[/color](3, [color=#006699]OUTPUT[/color]);
+
  pinMode(3, OUTPUT);
  [color=#CC6600]pinMode[/color](4, [color=#006699]OUTPUT[/color]);
+
  pinMode(4, OUTPUT);
  [color=#CC6600]pinMode[/color](5, [color=#006699]OUTPUT[/color]);
+
  pinMode(5, OUTPUT);
 
+
  [color=#7E7E7E]// pin13 LED[/color]
+
  // pin13 LED
  [color=#CC6600]pinMode[/color](13, [color=#006699]OUTPUT[/color]);
+
  pinMode(13, OUTPUT);
 
+
  [color=#7E7E7E]// enable pull-up resistors on switch pins (analog inputs)[/color]
+
  // enable pull-up resistors on switch pins (analog inputs)
  [color=#CC6600]digitalWrite[/color](14, [color=#006699]HIGH[/color]);
+
  digitalWrite(14, HIGH);
  [color=#CC6600]digitalWrite[/color](15, [color=#006699]HIGH[/color]);
+
  digitalWrite(15, HIGH);
  [color=#CC6600]digitalWrite[/color](16, [color=#006699]HIGH[/color]);
+
  digitalWrite(16, HIGH);
  [color=#CC6600]digitalWrite[/color](17, [color=#006699]HIGH[/color]);
+
  digitalWrite(17, HIGH);
  [color=#CC6600]digitalWrite[/color](18, [color=#006699]HIGH[/color]);
+
  digitalWrite(18, HIGH);
  [color=#CC6600]digitalWrite[/color](19, [color=#006699]HIGH[/color]);
+
  digitalWrite(19, HIGH);
 
+
  [color=#7E7E7E]//  if (!card.init(true)) { //play with 4 MHz spi if 8MHz isn't working for you[/color]
+
  //  if (!card.init(true)) { //play with 4 MHz spi if 8MHz isn't working for you
  [color=#CC6600]if[/color] (!card.init()) {        [color=#7E7E7E]//play with 8 MHz spi (default faster!)  [/color]
+
  if (!card.init()) {        //play with 8 MHz spi (default faster!)   
    putstring_nl([color=#006699]"Card init. failed!"[/color]);  [color=#7E7E7E]// Something went wrong, lets print out why[/color]
+
    putstring_nl("Card init. failed!");  // Something went wrong, lets print out why
    sdErrorCheck();
+
    sdErrorCheck();
    [color=#CC6600]while[/color](1);                            [color=#7E7E7E]// then 'halt' - do nothing![/color]
+
    while(1);                            // then 'halt' - do nothing!
  }
+
  }
  
+
 
  [color=#7E7E7E]// enable optimize read - some cards may timeout. Disable if you're having problems[/color]
+
  // enable optimize read - some cards may timeout. Disable if you're having problems
  card.partialBlockRead([color=#CC6600]true[/color]);
+
  card.partialBlockRead(true);
 
+
[color=#7E7E7E]// Now we will look for a FAT partition![/color]
+
// Now we will look for a FAT partition!
  uint8_t part;
+
  uint8_t part;
  [color=#CC6600]for[/color] (part = 0; part < 5; part++) {    [color=#7E7E7E]// we have up to 5 slots to look in[/color]
+
  for (part = 0; part < 5; part++) {    // we have up to 5 slots to look in
    [color=#CC6600]if[/color] (vol.init(card, part))  
+
    if (vol.init(card, part))  
      [color=#CC6600]break[/color];                            [color=#7E7E7E]// we found one, lets bail[/color]
+
      break;                            // we found one, lets bail
  }
+
  }
  [color=#CC6600]if[/color] (part == 5) {                      [color=#7E7E7E]// if we ended up not finding one  :([/color]
+
  if (part == 5) {                      // if we ended up not finding one  :(
    putstring_nl([color=#006699]"No valid FAT partition!"[/color]);
+
    putstring_nl("No valid FAT partition!");
    sdErrorCheck();      [color=#7E7E7E]// Something went wrong, lets print out why[/color]
+
    sdErrorCheck();     // Something went wrong, lets print out why
    [color=#CC6600]while[/color](1);                            [color=#7E7E7E]// then 'halt' - do nothing![/color]
+
    while(1);                            // then 'halt' - do nothing!
  }
+
  }
  
+
 
  [color=#7E7E7E]// Lets tell the user about what we found[/color]
+
  // Lets tell the user about what we found
  putstring([color=#006699]"Using partition "[/color]);
+
  putstring("Using partition ");
  [color=#CC6600][b]Serial[/b][/color].[color=#CC6600]print[/color](part, [color=#006699]DEC[/color]);
+
  Serial.print(part, DEC);
  putstring([color=#006699]", type is FAT"[/color]);
+
  putstring(", type is FAT");
  [color=#CC6600][b]Serial[/b][/color].[color=#CC6600]println[/color](vol.fatType(),[color=#006699]DEC[/color]);    [color=#7E7E7E]// FAT16 or FAT32?[/color]
+
  Serial.println(vol.fatType(),DEC);    // FAT16 or FAT32?
  
+
 
  [color=#7E7E7E]// Try to open the root directory[/color]
+
  // Try to open the root directory
  [color=#CC6600]if[/color] (!root.openRoot(vol)) {
+
  if (!root.openRoot(vol)) {
    putstring_nl([color=#006699]"Can't open root dir!"[/color]); [color=#7E7E7E]// Something went wrong,[/color]
+
    putstring_nl("Can't open root dir!"); // Something went wrong,
    [color=#CC6600]while[/color](1);                            [color=#7E7E7E]// then 'halt' - do nothing![/color]
+
    while(1);                            // then 'halt' - do nothing!
  }
+
  }
  
+
 
  [color=#7E7E7E]// Whew! We got past the tough parts.[/color]
+
  // Whew! We got past the tough parts.
  putstring_nl([color=#006699]"Ready!"[/color]);
+
  putstring_nl("Ready!");
 
}
 
}
  
[color=#CC6600]void[/color] playcomplete([color=#CC6600]char[/color] good) {
+
void playcomplete(char good) {
  [color=#7E7E7E]// call our helper to find and play this name[/color]
+
  // call our helper to find and play this name
  playfile([color=#006699]"GOOD.WAV"[/color]);
+
  playfile("GOOD.WAV");
  [color=#CC6600]while[/color] (wave.isplaying) {
+
  while (wave.isplaying) {
  [color=#7E7E7E]// do nothing while its playing[/color]
+
  // do nothing while its playing
  }
+
  }
  [color=#7E7E7E]// now its done playing[/color]
+
  // now its done playing
 
}
 
}
  
  
[color=#CC6600]void[/color] [color=#CC6600][b]loop[/b][/color]() {
+
void loop() {
  [color=#7E7E7E]//putstring(".");            // uncomment this to see if the loop isnt running  [/color]
+
  //putstring(".");            // uncomment this to see if the loop isnt running   
    
+
   
  [color=#CC6600]switch[/color] (check_switches()) {    [color=#7E7E7E]//this is the loop which cycles the arnold sounds based[/color]
+
  switch (check_switches()) {    //this is the loop which cycles the arnold sounds based
    [color=#CC6600]case[/color] 1:                      [color=#7E7E7E]//on which switch you connect to.[/color]
+
    case 1:                      //on which switch you connect to.
      playcomplete([color=#006699]"STOP.WAV"[/color]);
+
      playcomplete("STOP.WAV");
      [color=#CC6600]break[/color];
+
      break;
    [color=#CC6600]case[/color] 2:
+
    case 2:
      playcomplete([color=#006699]"SOB.WAV"[/color]);
+
      playcomplete("SOB.WAV");
      [color=#CC6600]break[/color];
+
      break;
    [color=#CC6600]case[/color] 3:
+
    case 3:
      playcomplete([color=#006699]"DONT.WAV"[/color]);
+
      playcomplete("DONT.WAV");
      [color=#CC6600]break[/color];
+
      break;
    [color=#CC6600]case[/color] 4:
+
    case 4:
      playcomplete([color=#006699]"LACK.WAV"[/color]);
+
      playcomplete("LACK.WAV");
      [color=#CC6600]break[/color];
+
      break;
    [color=#CC6600]case[/color] 5:
+
    case 5:
      playcomplete([color=#006699]"FIST.WAV"[/color]);
+
      playcomplete("FIST.WAV");
  }
+
  }
 
}
 
}
  
[color=#CC6600]byte[/color] check_switches()
+
byte check_switches()
 
{
 
{
  [color=#CC6600]static[/color] [color=#CC6600]byte[/color] previous[6];
+
  static byte previous[6];
  [color=#CC6600]static[/color] [color=#CC6600]long[/color] time[6];
+
  static long time[6];
  [color=#CC6600]byte[/color] reading;
+
  byte reading;
  [color=#CC6600]byte[/color] pressed;
+
  byte pressed;
  [color=#CC6600]byte[/color] index;
+
  byte index;
  pressed = 0;
+
  pressed = 0;
  
  [color=#CC6600]for[/color] ([color=#CC6600]byte[/color] index = 0; index < 6; ++index) {
+
  for (byte index = 0; index < 6; ++index) {
    reading = [color=#CC6600]digitalRead[/color](14 + index);
+
    reading = digitalRead(14 + index);
    [color=#CC6600]if[/color] (reading == [color=#006699]LOW[/color] && previous[index] == [color=#006699]HIGH[/color] && [color=#CC6600]millis[/color]() - time[index] > DEBOUNCE)
+
    if (reading == LOW && previous[index] == HIGH && millis() - time[index] > DEBOUNCE)
    {
+
    {
      [color=#7E7E7E]// switch pressed[/color]
+
      // switch pressed
      time[index] = [color=#CC6600]millis[/color]();
+
      time[index] = millis();
      pressed = index + 1;
+
      pressed = index + 1;
      [color=#CC6600]break[/color];
+
      break;
    }
+
    }
    previous[index] = reading;
+
    previous[index] = reading;
  }
+
  }
  [color=#7E7E7E]// return switch number (1 - 6)[/color]
+
  // return switch number (1 - 6)
  [color=#CC6600]return[/color] (pressed);
+
  return (pressed);
 
}
 
}
  
  
[color=#7E7E7E]// Plays a full file from beginning to end with no pause.[/color]
+
// Plays a full file from beginning to end with no pause.
[color=#CC6600]void[/color] playcomplete([color=#CC6600]char[/color] *name) {
+
void playcomplete(char *name) {
  [color=#7E7E7E]// call our helper to find and play this name[/color]
+
  // call our helper to find and play this name
  playfile(name);
+
  playfile(name);
  [color=#CC6600]while[/color] (wave.isplaying) {
+
  while (wave.isplaying) {
  [color=#7E7E7E]// do nothing while its playing[/color]
+
  // do nothing while its playing
  }
+
  }
  [color=#7E7E7E]// now its done playing[/color]
+
  // now its done playing
 
}
 
}
  
[color=#CC6600]void[/color] playfile([color=#CC6600]char[/color] *name) {
+
void playfile(char *name) {
  [color=#7E7E7E]// see if the wave object is currently doing something[/color]
+
  // see if the wave object is currently doing something
  [color=#CC6600]if[/color] (wave.isplaying) {[color=#7E7E7E]// already playing something, so stop it![/color]
+
  if (wave.isplaying) {// already playing something, so stop it!
    wave.[color=#CC6600]stop[/color](); [color=#7E7E7E]// stop it[/color]
+
    wave.stop(); // stop it
  }
+
  }
  [color=#7E7E7E]// look in the root directory and open the file[/color]
+
  // look in the root directory and open the file
  [color=#CC6600]if[/color] (!f.open(root, name)) {
+
  if (!f.open(root, name)) {
    putstring([color=#006699]"Couldn't open file "[/color]); [color=#CC6600][b]Serial[/b][/color].[color=#CC6600]print[/color](name); [color=#CC6600]return[/color];
+
    putstring("Couldn't open file "); Serial.print(name); return;
  }
+
  }
  [color=#7E7E7E]// OK read the file and turn it into a wave object[/color]
+
  // OK read the file and turn it into a wave object
  [color=#CC6600]if[/color] (!wave.create(f)) {
+
  if (!wave.create(f)) {
    putstring_nl([color=#006699]"Not a valid WAV"[/color]); [color=#CC6600]return[/color];
+
    putstring_nl("Not a valid WAV"); return;
  }
+
  }
  
+
 
  [color=#7E7E7E]// ok time to play! start playback[/color]
+
  // ok time to play! start playback
  wave.play();
+
  wave.play();
 
}
 
}
 
+
</pre>
[/quote]
+
----
 +
http://i238.photobucket.com/albums/ff152/3pod151/School%20Stuff/DSC_0229.jpg http://i238.photobucket.com/albums/ff152/3pod151/School%20Stuff/DSC_0232.jpg
 +
http://i238.photobucket.com/albums/ff152/3pod151/School%20Stuff/DSC_0241.jpg
 +
----
 +
http://i238.photobucket.com/albums/ff152/3pod151/School%20Stuff/DSC_0246.jpg
 +
http://i238.photobucket.com/albums/ff152/3pod151/School%20Stuff/DSC_0253.jpg

Latest revision as of 13:51, 20 March 2010

I am a Visual Arts - Media major with an interest in graphic design. I was born in Europe, and moved to Canada when I was 5. I've lived in San Diego since I was 10, and graduated from University City High School before coming to UCSD as a transfer. I have been working with computers since grade school, and am highly interested in pursuing a career in the computer field. I have been in interested in electronics also since a young age and I think it will add an interesting dimension to my artistic career, and am eagerly looking forward to learning how to make art projects using them.


DSC_0055-1.jpg

Portable Heater


DSC_0051.jpg

Generator?


DSC_0050.jpg

Air Conditioner


DSC_0049.jpg

Cell Phone


DSC_0046.jpg

Car Keys


Midterm Proposal

My proposal is a hat which contains a cooling fan enabled by a switch. The switch will hang down from the inside of the hat to about shoulder length, enabling the wearer to turn on and off the fan. This is a crude implementation of a warm weather cowboy hat which provides cooling apart from shade. It will be powered by a 9v battery, and connected by a normally open switch. In order to operate the fan, you must hold down the button.


MidDiag.jpg


Final Proposal

My final project will be called "Punch a Celebrity". It will consist of a punching pad with a picture of a celebrity on it. The pad will have an impact sensor attached to a arduino/breakout board, which is attached to a speaker. This will enable a wav or mp3 file to play at the moment of impact, and simulate that you are actually hitting a celebrity.

proposal.png

Code


//Ian Petrov VIS147A Final
//code edited from Adafruit Wave Shield Site
#include <FatReader.h>
#include <SdReader.h>
#include <avr/pgmspace.h>
#include "WaveUtil.h"
#include "WaveHC.h"


SdReader card;    // This object holds the information for the card
FatVolume vol;    // This holds the information for the partition on the card
FatReader root;   // This holds the information for the filesystem on the card
FatReader f;      // This holds the information for the file we're play

WaveHC wave;      // This is the only wave (audio) object, since we will only play one at a time

#define DEBOUNCE 100  // button debouncer

// this handy function will return the number of bytes currently free in RAM, great for debugging!   
int freeRam(void)
{
  extern int  __bss_end; 
  extern int  *__brkval; 
  int free_memory; 
  if((int)__brkval == 0) {
    free_memory = ((int)&free_memory) - ((int)&__bss_end); 
  }
  else {
    free_memory = ((int)&free_memory) - ((int)__brkval); 
  }
  return free_memory; 
} 

void sdErrorCheck(void)
{
  if (!card.errorCode()) return;
  putstring("\n\rSD I/O error: ");
  Serial.print(card.errorCode(), HEX);
  putstring(", ");
  Serial.println(card.errorData(), HEX);
  while(1);
}

void setup() {
  // set up serial port
  Serial.begin(9600);
  putstring_nl("WaveHC with 6 buttons");
  
   putstring("Free RAM: ");       // This can help with debugging, running out of RAM is bad
  Serial.println(freeRam());      // if this is under 150 bytes it may spell trouble!
  
  // Set the output pins for the DAC control. This pins are defined in the library
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
 
  // pin13 LED
  pinMode(13, OUTPUT);
 
  // enable pull-up resistors on switch pins (analog inputs)
  digitalWrite(14, HIGH);
  digitalWrite(15, HIGH);
  digitalWrite(16, HIGH);
  digitalWrite(17, HIGH);
  digitalWrite(18, HIGH);
  digitalWrite(19, HIGH);
 
  //  if (!card.init(true)) { //play with 4 MHz spi if 8MHz isn't working for you
  if (!card.init()) {         //play with 8 MHz spi (default faster!)  
    putstring_nl("Card init. failed!");  // Something went wrong, lets print out why
    sdErrorCheck();
    while(1);                            // then 'halt' - do nothing!
  }
  
  // enable optimize read - some cards may timeout. Disable if you're having problems
  card.partialBlockRead(true);
 
// Now we will look for a FAT partition!
  uint8_t part;
  for (part = 0; part < 5; part++) {     // we have up to 5 slots to look in
    if (vol.init(card, part)) 
      break;                             // we found one, lets bail
  }
  if (part == 5) {                       // if we ended up not finding one  :(
    putstring_nl("No valid FAT partition!");
    sdErrorCheck();      // Something went wrong, lets print out why
    while(1);                            // then 'halt' - do nothing!
  }
  
  // Lets tell the user about what we found
  putstring("Using partition ");
  Serial.print(part, DEC);
  putstring(", type is FAT");
  Serial.println(vol.fatType(),DEC);     // FAT16 or FAT32?
  
  // Try to open the root directory
  if (!root.openRoot(vol)) {
    putstring_nl("Can't open root dir!"); // Something went wrong,
    while(1);                             // then 'halt' - do nothing!
  }
  
  // Whew! We got past the tough parts.
  putstring_nl("Ready!");
}

void playcomplete(char good) {
  // call our helper to find and play this name
  playfile("GOOD.WAV");
  while (wave.isplaying) {
  // do nothing while its playing
  }
  // now its done playing
}


void loop() {
  //putstring(".");            // uncomment this to see if the loop isnt running  
    
  switch (check_switches()) {     //this is the loop which cycles the arnold sounds based
    case 1:                       //on which switch you connect to.
      playcomplete("STOP.WAV");
      break;
    case 2:
      playcomplete("SOB.WAV");
      break;
    case 3:
      playcomplete("DONT.WAV");
      break;
    case 4:
      playcomplete("LACK.WAV");
      break;
    case 5:
      playcomplete("FIST.WAV");
  }
}

byte check_switches()
{
  static byte previous[6];
  static long time[6];
  byte reading;
  byte pressed;
  byte index;
  pressed = 0;

  for (byte index = 0; index < 6; ++index) {
    reading = digitalRead(14 + index);
    if (reading == LOW && previous[index] == HIGH && millis() - time[index] > DEBOUNCE)
    {
      // switch pressed
      time[index] = millis();
      pressed = index + 1;
      break;
    }
    previous[index] = reading;
  }
  // return switch number (1 - 6)
  return (pressed);
}


// Plays a full file from beginning to end with no pause.
void playcomplete(char *name) {
  // call our helper to find and play this name
  playfile(name);
  while (wave.isplaying) {
  // do nothing while its playing
  }
  // now its done playing
}

void playfile(char *name) {
  // see if the wave object is currently doing something
  if (wave.isplaying) {// already playing something, so stop it!
    wave.stop(); // stop it
  }
  // look in the root directory and open the file
  if (!f.open(root, name)) {
    putstring("Couldn't open file "); Serial.print(name); return;
  }
  // OK read the file and turn it into a wave object
  if (!wave.create(f)) {
    putstring_nl("Not a valid WAV"); return;
  }
  
  // ok time to play! start playback
  wave.play();
}

DSC_0229.jpg DSC_0232.jpg DSC_0241.jpg


DSC_0246.jpg DSC_0253.jpg