proximity sensing using a bare touch board

hello there! i recently purchased a bare conductive touch board starter kit and have been slowly figuring my way through very simple tasks. i was intrigued by a proximity sensing tutorial i found here: http://www.bareconductive.com/make/proximity/

I followed every step and felt i was making progress. I got to step 3 and hit a wall. It simply says to upload the code. When I go to do so, I am hit with an error message. I have little prior coding knowledge and tried everything I could think to do, along with hours of Googling. The problem occurs in a certain line of the sketch that I believe is defining the SD card. I’ve read elsewhere that people have used this same sketch and achieved their goal. I have included the error message and a screen shot. I have an Arduino Uno starter kit and a couple of books on the way but I was hoping to continue to learn using this set-up in the meantime. Any help would be greatly appreciated!

Here is the code:

/*******************************************************************************

 Bare Conductive Proximity MP3 player
 ------------------------------
 
 proximity_mp3.ino - proximity triggered MP3 playback
 
 Based on code by Jim Lindblom and plenty of inspiration from the Freescale 
 Semiconductor datasheets and application notes.
 
 Bare Conductive code written by Stefan Dzisiewski-Smith and Peter Krige.
 
 This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 
 Unported License (CC BY-SA 3.0) http://creativecommons.org/licenses/by-sa/3.0/
 
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.

*******************************************************************************/

// compiler error handling
#include "Compiler_Errors.h"

// touch includes
#include <MPR121.h>
#include <Wire.h>
#define MPR121_ADDR 0x5C
#define MPR121_INT 4

// mp3 includes
#include <SPI.h>
#include <SdFat.h>
#include <SdFatUtil.h> 
#include <SFEMP3Shield.h>

// mp3 variables
SFEMP3Shield MP3player;
byte result;
int lastPlayed = 0;

// touch behaviour definitions
#define firstPin 0
#define lastPin 11

// sd card instantiation
SdFat sd;

// define LED_BUILTIN for older versions of Arduino
#ifndef LED_BUILTIN
#define LED_BUILTIN 13
#endif

void setup(){  
  Serial.begin(57600);
  
  pinMode(LED_BUILTIN, OUTPUT);
   
  //while (!Serial) ; {} //uncomment when using the serial monitor 
  Serial.println("Bare Conductive Proximity MP3 player");

  if(!sd.begin(SD_SEL, SPI_HALF_SPEED)) sd.initErrorHalt();

  if(!MPR121.begin(MPR121_ADDR)) Serial.println("error setting up MPR121");
  MPR121.setInterruptPin(MPR121_INT);
  
  // Changes from Touch MP3
  
  // this is the touch threshold - setting it low makes it more like a proximity trigger
  // default value is 40 for touch
  MPR121.setTouchThreshold(8);
  
  // this is the release threshold - must ALWAYS be smaller than the touch threshold
  // default value is 20 for touch
  MPR121.setReleaseThreshold(4);  

  result = MP3player.begin();
  MP3player.setVolume(10,10);
 
  if(result != 0) {
    Serial.print("Error code: ");
    Serial.print(result);
    Serial.println(" when trying to start MP3 player");
   }
   
}

void loop(){
  readTouchInputs();
}


void readTouchInputs(){
  if(MPR121.touchStatusChanged()){
    
    MPR121.updateTouchData();

    // only make an action if we have one or fewer pins touched
    // ignore multiple touches
    
    if(MPR121.getNumTouches()<=1){
      for (int i=0; i < 12; i++){  // Check which electrodes were pressed
        if(MPR121.isNewTouch(i)){
        
            //pin i was just touched
            Serial.print("pin ");
            Serial.print(i);
            Serial.println(" was just touched");
            digitalWrite(LED_BUILTIN, HIGH);
            
            if(i<=lastPin && i>=firstPin){
              if(MP3player.isPlaying()){
                if(lastPlayed==i){
                  // if we're already playing the requested track, stop it
                  MP3player.stopTrack();
                  Serial.print("stopping track ");
                  Serial.println(i-firstPin);
                } else {
                  // if we're already playing a different track, stop that 
                  // one and play the newly requested one
                  MP3player.stopTrack();
                  MP3player.playTrack(i-firstPin);
                  Serial.print("playing track ");
                  Serial.println(i-firstPin);
                  
                  // don't forget to update lastPlayed - without it we don't
                  // have a history
                  lastPlayed = i;
                }
              } else {
                // if we're playing nothing, play the requested track 
                // and update lastplayed
                MP3player.playTrack(i-firstPin);
                Serial.print("playing track ");
                Serial.println(i-firstPin);
                lastPlayed = i;
              }
            }     
        }else{
          if(MPR121.isNewRelease(i)){
            Serial.print("pin ");
            Serial.print(i);
            Serial.println(" is no longer being touched");
            digitalWrite(LED_BUILTIN, LOW);
         } 
        }
      }
    }
  }
}

And the error message:

Arduino: 1.6.5 (Windows 7), Board: “Bare Conductive Touch Board”

Build options changed, rebuilding all

Using library MPR121 in folder: C:\Program Files (x86)\Arduino\libraries\MPR121 (legacy)

Using library Wire in folder: C:\Program Files (x86)\Arduino\hardware\bare-conductive-arduino-public\avr\libraries\Wire (legacy)

Using library SPI in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI

Using library SdFat.h in folder: C:\Program Files (x86)\Arduino\libraries\SdFat.h (legacy)

Using library SFEMP3Shield in folder: C:\Program Files (x86)\Arduino\libraries\SFEMP3Shield (legacy)

C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_BARETOUCH -DARDUINO_ARCH_AVR -DUSB_VID=0x2A6E -DUSB_PID=0x8003 -DUSB_MANUFACTURER=“Bare Conductive” -DUSB_PRODUCT=“Touch Board” -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\leonardo -IC:\Program Files (x86)\Arduino\libraries\MPR121 -IC:\Program Files (x86)\Arduino\hardware\bare-conductive-arduino-public\avr\libraries\Wire -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI -IC:\Program Files (x86)\Arduino\libraries\SdFat.h -IC:\Program Files (x86)\Arduino\libraries\SFEMP3Shield C:\Users\Ethan\AppData\Local\Temp\build4238099441793278476.tmp\Proximity_MP3.cpp -o C:\Users\Ethan\AppData\Local\Temp\build4238099441793278476.tmp\Proximity_MP3.cpp.o

In file included from Proximity_MP3.ino:41:0:
C:\Program Files (x86)\Arduino\libraries\SFEMP3Shield/SFEMP3Shield.h:96:8: error: ‘SdFat’ does not name a type
extern SdFat sd;
^
Proximity_MP3.ino:53:1: error: ‘SdFat’ does not name a type
Proximity_MP3.ino: In function ‘void setup()’:
Proximity_MP3.ino:68:7: error: ‘sd’ was not declared in this scope
‘SdFat’ does not name a type

Thanks again!

I've read elsewhere that people have used this same sketch and achieved their goal.

Those would be people that had already downloaded and installed the SdFat library properly.

Happy to help. Did you make sure to follow our tutorial on setting up Arduino for the Touch Board? first before uploading the code? One way to confirm that you're on the right track is to open Arduino, then select File>Examples there you should see both MPR121 and SdFat. You should be able to hover on those and then see examples underneath. If not then the folder structure is most likely wrong and I'd go through our tutorial again starting from Step 4.

I did follow a tutorial, it was just the one from Bare. But they didn't have any Sd files that they mentioned. I had moved all of the files that errored when I tried compiling into different folders and was making progress up until this point. I will try a different tutorial later on today. Thanks for your help!

Make sure to check step 9 of the tutorial this is the step where we ask you to install the "SdFat" and "SFEMP3Shield" libraries.

I had followed all of the steps, just had them in the wrong folders. It is now up and running like I was hoping. Attention to details moving forward. Thanks again you've been a big help!