Hi everyone.
I begin my project for a little home automation.
I want to read a room temp , a motion sensor and to on/off the light.
I made the code for this and works great with this shield ENC28J60 Ethernet LAN / Network Module
ebay.com/itm/NEW-ENC28J60-Ethernet-LAN-Network-Module-For-51-AVR-STM32-LPC-/140717532321?pt=LH_DefaultDomain_0&hash=item20c36b24a1
I use the thiseldo-EtherShield-3793b4c library.
Now i connect the sd card shield
ebay.com/itm/SD-Card-Module-Slot-Socket-Reader-For-Arduino-ARM-MCU-NEW-/140717254516?pt=LH_DefaultDomain_0&hash=item20c366e774
on the arduino at the same pins like enc28j60 shield :
CS 53
MOSI 51
MISO 50
SCK 52
If you see in the image of sd card shield it has a double pins and one part i use to likn the sd card shield to the arduino pins and other part for link the enc shield to sd card shield.
I tested in this configuration the ethernet code and sd code but not in the same code , only one by one and they works separatly.
When i combined code , doesn't work.
So please tell me if i cand use the same pin 53 for many shields, or if i must do something in my code.
I want to load an image from sd card to use it like a backgroun on my web page and open a file where to write all operation who was made on my web page.
This is my code (a part of it for initialisation)
#include <etherShield.h>
#include <SdFat.h>
sdFat sd;
SdFile file;
#define error(s) sd.errorHalt_P(PSTR(s))
static uint8_t mac[6] = {0x54, 0x55, 0x58, 0x10, 0x00, 0x24}; //Mac address
static uint8_t ip[4] = {192, 168, 1, 15}; //IP address
static uint16_t port = 80; //port 80
ETHER28J60 e;
void setup()
{
Serial.begin(9600);
//initializare ethernet
e.setup(mac, ip, port);
//initializare sd card
if (!sd.init(SPI_HALF_SPEED)) sd.initErrorHalt();
char name[] = "WRITE00.TXT";
if (file.open(name, O_CREAT | O_EXCL | O_WRITE)) break;
if (!file.isOpen()) error ("file.create");
}
void loop
{
void loop()
{
char* params;
if (params = e.serviceRequest())
{
e.print("
TAO13 HOME SYSTEM PAGE
");e.print("<body background="image2.gif">"); \where image2.gif found on my sd card
e.print("");
e.respond();
}
}
Many thanks everyone.