Pages: [1]   Go Down
Author Topic: SD not declared in this scope  (Read 281 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 142
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

h
Code:
#ifndef Card_h
#define Card_h

#include "Arduino.h"
#include <SD.h>"

class Card{
 
public:
 void init();

private:
  int CS_pin;
};



#endif

source:

Code:
#include "Arduino.h"
#include "Card.h"

void Card::init(){

pinMode(CS_pin, OUTPUT);
if(!SD.begin(CS_pin)){
    Serial.println("Card Failed");
    return;
  }
  Serial.println("Card Ready");

 
}

I've read some web articles describing how to write libraries and I seem to be consistently failing at making this work.  I wrote a single sketch to see if I could read some info off of a SD card.  When I start to try and write a library to accomplish the task I get the error:

Code:
Card.cpp:9: error: 'SD' was not declared in this scope
  can someone explain why this doesn't work?

Thanks,

Loren
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 547
Posts: 45978
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

We need to see your sketch, too. I'm guessing, though, that it does not include SD.h. It needs to.
Logged

0
Offline Offline
Shannon Member
****
Karma: 159
Posts: 10409
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
#include <SD.h>"

Syntax error...?
Logged

[ I won't respond to messages, use the forum please ]

0
Offline Offline
Full Member
***
Karma: 0
Posts: 142
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

We need to see your sketch, too. I'm guessing, though, that it does not include SD.h. It needs to.

Yep that was it.  Thanks again

Logged

Pages: [1]   Go Up
Jump to: