problems with arduino ethernet and its SD card
anyone knows why when use arduino ethernet server can not use sd card save event or if want send email event , want monitoring state of arduino ethernet @ same time in 1 sketch not works attached part of code because all functions that wanted work think both more important me.
if separate test works problem when want work both @ same time
thanks me.
code: [select]
void loop()
{
internet();
if ((estadosensor = digitalread(sensor)) == 1) email();
}
/****************************************************************/
void internet()
{
ethernetclient client = server.available();
if (client) {
boolean currentlineisblank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
if (c == '\n' && currentlineisblank) {
client.println("http/1.1 200 ok");
client.println("content-type: text/html");
client.println("connection: close");
client.println();
client.println("<!doctype html>");
client.println("<html>");
client.println("<meta http-equiv=\"refresh\" content=\"5\">");
client.println("<br />");
client.println("<br />");
client.println("<center>arduino ethernet</center>");
client.println("<br />");
client.println("<br />");
myfile = sd.open("datalog.txt");
if (myfile)
{
while(myfile.available())
{
client.write(myfile.read());
}
client.println("<br />");
client.println();
}
myfile.close();
client.println("</html>");
break;
}
if (c == '\n') {
currentlineisblank = true;
}
else if (c != '\r') {
currentlineisblank = false;
}
}
}
delay(1);
client.stop();
}
}
/****************************************************************/
void email()
{
if (client.connect(smtp,8025)) //2525/25/8025/587/465/8465 // tried ports , works
{
delay(500);
client.println("ehlo");
delay(500);
client.println("auth login");
delay(500);
client.println("xxxxxxxxxxxxxxxxxxxx");
delay(500);
client.println("xxxxxxxxxxxxxxxxxxxx");
delay(500);
client.println("mail from: xxxxxxxxxxx@gmail.com");
delay(500);
client.println("rcpt to: xxxxxxxxxxx@hotmail.com");
delay(500);
client.println("data");
delay(500);
client.println("to: xxxxxxx");
delay(500);
client.println("from: xxxxxxx");
delay(500);
client.println("subject: mensaje de prueba");
delay(500);
client.println();
delay(500);
client.println("**************");
delay(500);
client.println("alerta sensor activo");
delay(500);
client.println("**************");
delay(500);
client.println(".");
delay(500);
client.println("quit");
}
else
{
client.stop();
}
}
you should post code. here mine.
web server.
http://playground.arduino.cc/code/webserverst
email client.
http://playground.arduino.cc/code/email
ftp client(w5100 , sd working together).
http://playground.arduino.cc/code/ftp
you may running bit low on sram uno-type processor. 2k doesn't go far. need f() macro static strings. @ of sketches example.
web server.
http://playground.arduino.cc/code/webserverst
email client.
http://playground.arduino.cc/code/email
ftp client(w5100 , sd working together).
http://playground.arduino.cc/code/ftp
you may running bit low on sram uno-type processor. 2k doesn't go far. need f() macro static strings. @ of sketches example.
Arduino Forum > Using Arduino > Storage > problems with arduino ethernet and its SD card
arduino
Comments
Post a Comment