Show Posts
Pages: [1] 2
1  Using Arduino / Programming Questions / Re: Arduino ethernet shield fail to send email----please help??????? on: April 09, 2013, 10:02:09 pm
Quote
Thanks I will try that when I get to a windows laptop. I am using a mackbook the  moment
Don't bother then. Here is the Mac version:
http://www.mactip.net/share-internet-connection-mac/


Thanks its now showing some hope... Here is what it is showing now:

St192.168.2.2
Starting w5100...192.168.2.2
Ready. Press 'e' to send.
connected
220 mx.google.com ESMTP g9sm32595507wix.1 - gsmtp
Sending helo
250 mx.google.com at your service
Sending From
530 5.7.0 Must issue a STARTTLS command first. g9sm32595507wix.1 - gsmtp
221 2.0.0 closing connection g9sm32595507wix.1 - gsmtp
disconnected
Email failed

Additional question, the IP add in this part "client.println("helo 1.2.3.4");" is it supposed to be the same with the one initialised at the beginning of the code
2  Using Arduino / Programming Questions / Re: Arduino ethernet shield fail to send email----please help??????? on: April 05, 2013, 08:34:28 am
Quote
my laptop is connected to the college's wifi and I then connect the ES to the laptop via a cross over cable
AH HA!! Now we are getting somewhere. You must enable Internet Connection Sharing (ICS) on your Windows laptop. Here is the ICS setup for WinXP, but I think the newer versions of Windows uses basically the same type setup.
http://support.microsoft.com/kb/306126


Thanks I will try that when I get to a windows laptop. I am using a mackbook the  moment
3  Using Arduino / Programming Questions / Re: Arduino ethernet shield fail to send email----please help??????? on: April 05, 2013, 08:01:12 am
Quote
As for the IP address I used one for my laptop is there a problem with that?
Yes. No duplicate ips or mac addresses on the localnet. That causes serious routing problems. You should check your router setup to determine the network settings for your localnet.

This (169.254.134.1) is similar to the ip Windows uses if unable to get an ip from a dhcp server on the localnet.


I think I am begging to understand this. So do I just assign an IP add that is not assigned to anything?

I have altered the test code for the SPI. The code is below and this is what is showing me, I think its because of the way my stuff is connected:

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = {  0x90, 0xA2, 0xDA, 0x00, 0xFC, 0x47 }; // Arduino's artificial mac address
//byte IP[] = {169,254,245,182};
IPAddress ip(169,254,245,182);

void setup() {
  Serial.begin(9600);

  // disable SD card if one in the slot
  pinMode(4,OUTPUT);
  digitalWrite(4,HIGH);

  Serial.println("Starting w5100");
  if(!Ethernet.begin(mac)) Serial.println("failed");
else Serial.println(Ethernet.localIP());

  //Serial.println(Ethernet.localIP());
}

void loop() {
}

this is what its giving me :
StStarting w5100
failed

my laptop is connected to the college's wifi and I then connect the ES to the laptop via a cross over cable
4  Using Arduino / Programming Questions / Re: Arduino ethernet shield fail to send email----please help??????? on: April 05, 2013, 07:39:21 am
Quote
Starting w5100...failed
It appears you have network setup problems. If that is the response you get from the dhcp setup, then there is no dhcp server on that localnet. You must figure out the network settings for your localnet. I can't tell from here.

edit: You can check the SPI connection between the Arduino and ethernet shield with the code on this post:
http://arduino.cc/forum/index.php/topic,156082.msg1169948.html#msg1169948
Does it display 192.168.2.2?

If you have a SD card in the shield slot, remove it for these tests.


I have tried testing the SPI ist working its displaying the ip add in the serial monitor.

As for the IP address I used one for my laptop is there a problem with that?

5  Using Arduino / Programming Questions / Re: Arduino ethernet shield fail to send email----please help??????? on: April 05, 2013, 07:06:21 am
I suspect this is the cause.
Code:
byte ip[] = { 169,254,134,1};  
Are you sure that is the correct ip for your localnet? If you have questions, use dhcp to obtain an ip and see what it is issued. Replace your Ethernet.begin() with this:
Code:
Serial.print("Starting w5100...");
if(!Ethernet.begin(mac)) Serial.println("failed");
else Serial.println(Ethernet.localIP());

edit: This won't work either:
Code:
char server[] = "smtp.gmail.com";


You must use nslookup to determine the server for inbound email. From a command prompt
Code:
nslookup
set query = mx
gmail.com

Thanks very much SurferTim for the help. i tried the first one and its showing whats below. I will try and use the nslookup. I am using a Mac though do u know how I can do it on a Mac? For the mail server is supposed to be in the formart of an IP add or the one I used earlier?

StStarting w5100...failed
Ready. Press 'e' to send.
connected
6  Using Arduino / Programming Questions / Re: Arduino ethernet shield fail to send email----please help??????? on: April 05, 2013, 06:27:08 am
Try the code in this link. It displays the responses from the email server to all those sends. That might help you figure out what is causing the fail.
http://playground.arduino.cc/Code/Email


thanks I have tried it and he is what is is giving me:
Ready. Press 'e' to send.
connection failed
Email failed
connection failed

Below is the code I used, I have just put false email address and ip add for security . Please point me where I am going wrong:

/*
   Email client sketch for IDE v1.0.1 and w5100/w5200
   Posted December 2012 by SurferTim
*/

#include <SPI.h>
#include <Ethernet.h>

// this must be unique
byte mac[] = {  0x90, 0xA2, 0xDA, 0x00, 0xGC, 0x47 }; // Arduino's artificial mac address
byte ip[] = { 169,254,134,1};   
// change network settings to yours
//IPAddress ip( 192, 168, 2, 2 );   
IPAddress gateway( 192, 168, 2, 1 );
IPAddress subnet( 255, 255, 255, 0 );

// change server to your email server ip or domain
//IPAddress server( 169,254,134,131);
char server[] = "smtp.gmail.com";
//char server[] = "email.yourdomain.com";

EthernetClient client;

void setup()
{
  Serial.begin(9600);
  pinMode(4,OUTPUT);
  digitalWrite(4,HIGH);
  Ethernet.begin(mac, ip);
  delay(2000);
  Serial.println("Ready. Press 'e' to send.");
}

void loop()
{
  byte inChar;

  inChar = Serial.read();

  if(inChar == 'e')
  {
      if(sendEmail()) Serial.println("Email sent");
      else Serial.println("Email failed");
  }
}

byte sendEmail()
{
  byte thisByte = 0;
  byte respCode;

  if(client.connect(server,25)) {
    Serial.println("connected");
  } else {
    Serial.println("connection failed");
    return 0;
  }

  if(!eRcv()) return 0;
  Serial.println("Sending helo");

// change to your public ip
  client.println("helo 169.254.134.1");

  if(!eRcv()) return 0;
  Serial.println("Sending From");

// change to your email address (sender)
  client.println("MAIL From: <email@gmail.com>");

  if(!eRcv()) return 0;

// change to recipient address
  Serial.println("Sending To");
  client.println("RCPT To: <email@me.com>");

  if(!eRcv()) return 0;

  Serial.println("Sending DATA");
  client.println("DATA");

  if(!eRcv()) return 0;

  Serial.println("Sending email");

// change to recipient address
  client.println("To: You <email@me.com>");

// change to your address
  client.println("From: Me <email@gmail.com>");

  client.println("Subject: Arduino email test");

  client.println("This is from my Arduino!");

  client.println(".");

  if(!eRcv()) return 0;

  Serial.println("Sending QUIT");
  client.println("QUIT");

  if(!eRcv()) return 0;

  client.stop();

  Serial.println("disconnected");

  return 1;
}

byte eRcv()
{
  byte respCode;
  byte thisByte;

  while(!client.available()) delay(1);

  respCode = client.peek();

  while(client.available())
  { 
    thisByte = client.read();   
    Serial.write(thisByte);
  }

  if(respCode >= '4')
  {
    efail();
    return 0; 
  }

  return 1;
}


void efail()
{
  byte thisByte = 0;

  client.println("QUIT");

  while(!client.available()) delay(1);

  while(client.available())
  { 
    thisByte = client.read();   
    Serial.write(thisByte);
  }

  client.stop();

  Serial.println("disconnected");

}
7  Using Arduino / Programming Questions / Re: Arduino ethernet shield fail to send email----please help??????? on: April 05, 2013, 05:29:09 am
and this is the  code I used:


#include <SPI.h>
#include <Ethernet.h>
#include <WString.h>

byte mac[] = {  0x90, 0xD4, 0xDA, 0x00, 0xRT, 0x47 }; // Arduino's artificial mac address
byte ip[] = { 169,254,159,0}; // my ip
byte server[] = { 64, 233, 167, 11}; // my smtp server ip
int time = 5000;
int wait = 2000;


//Client client(server, 25);
EthernetClient client;

//EthernetServer server(25);

void setup()
{
  delay(time);
 
  Ethernet.begin(mac, ip);
  Serial.begin(9600);
 
  delay(1000);
 
  Serial.println("connecting...");
 
  if (!client.connected()) {
                         Serial.println("connected");
   
                         client.println("HELO itismeletschat"); /* say hello (statement after helo is needed but irrelevant)*/
                           delay(wait); /* wait for a response */

                         client.println("MAIL From:XXmgerallds@gmail.com"); /* identify sender, this should be the same as the smtp server you are using */
                           delay(wait); /* wait for a response */

                         client.println("RCPT To:XX@yahoo.co.uk"); /* identify recipient */
                         delay(wait); /* wait for a response */

                         client.println("DATA");
                           delay(wait); /* wait for a response */
 
                         client.println("To: XXX@yahoo.co.uk"); /* identify recipient */
                         client.println("Subject: You Have Mail!!"); /* insert subject */

                         client.println("Please let me know it worked!!!"); /* insert body */
                         client.println("."); /* end email */
                 
                         client.println("QUIT"); /* terminate connection */
                          delay(wait); /* wait for a response */

   
    client.println();
   
  } else {
    Serial.println("connection failed");
  }
}

void loop()
{
  while (client.available()) {
    char c = client.read();
    Serial.print(c);
  }
 
  if (!client.connected()) {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
    for(;smiley-wink
      ;
  }
}
8  Using Arduino / Programming Questions / Re: Arduino ethernet shield fail to send email----please help??????? on: April 05, 2013, 05:23:57 am
Hi I am trying to get the Arduino to send an email and fail. I have a couple of questions:
1. How do I get the email server address on a Mac?
2. The IP add in the code is it for the computer I will be using?
 
I have tried code from: and this is what I am getting,

"cconnecting...
connected

disconnecting."
 
No email is being sent
 I changed the IP and MAC add and also the server add to the gmail one that O just got from the same thread in that forum.

Thanks for taking time to read
9  Using Arduino / Networking, Protocols, and Devices / Re: RF433 MHz transmitter does not send on: February 25, 2013, 08:13:33 pm
i want to use one Arduino hooked up to an Quasar AM transmitter and it has to communicate with an AM Receiver. I want to control LEDs wirelessly using this cheap method, Please help
10  Using Arduino / Programming Questions / Re: Webserver and timer functions on: February 20, 2013, 09:22:36 am
Thanks will try this and let you know how it goes.

Code:
   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
 
 
  cli();//stop or disable interrupts

  //setting timer1 to interrupt at 1Hz
  TCCR1A = 0;// setting entire TCCR1A register to 0
  TCCR1B = 0;// setting entire TCCR1A register to 0
  TCNT1  = 0;//initialize counter value to 0

    // set compare match register for 1hz increments
  OCR1A = 15624;// = (16*10^6) / (1*1024) - 1 (must be <65536)
  // turn on CTC mode
  TCCR1B |= (1 << WGM12);
  // Set CS10 and CS12 bits for 1024 prescaler
  TCCR1B |= (1 << CS12) | (1 << CS10); 
  // enable timer compare interrupt
  TIMSK1 |= (1 << OCIE1A);

  sei();//enable interrupts
  X10.init(RTS_PIN, DTR_PIN, BIT_DELAY);
  }
99% of this stuff does not belong in the while loop. The body of the while loop is SUPPOSED to be that ;.
11  Using Arduino / Networking, Protocols, and Devices / Re: Refreshing Web Site Without Resending Data? on: February 20, 2013, 09:21:45 am
Thanks it works as I wanted!

Quote
How do I use the Meta-refresh command in code? Thanks

Code:
/ zoomkat meta refresh server test code
// arduino IDE 1.0
// for W5100 ethernet shield
// the IP address will be dependent on your local network/router
// port 80 is default for HTTP, but can be changed as needed
// use IP address like http://192.168.1.102:84 in your brouser
// or http://zoomkat.no-ip.com:84 with dynamic IP service
// use the \ slash to escape the " in the html
// meta refresh set for 2 seconds

#include <SPI.h>
#include <Ethernet.h>

int x=0; //set refresh counter to 0
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,1,102); // ip in lan
EthernetServer server(84); //server is using port 84

void setup()
{
  // start the server
  Ethernet.begin(mac, ip);
  server.begin();
}

void loop()
{
  // listen for incoming clients
  EthernetClient client = server.available();
  if (client) {
     while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        // see if HTTP request has ended with blank line
        if (c == '\n') {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();
         
          //meta-refresh page every 2 seconds
          x=x+1; //page upload counter
          client.println("<HTML>");
          client.print("<HEAD>");
          client.print("<meta http-equiv='refresh' content='2'>"); //url='http://192.168.1.102:84/'
          client.print("<TITLE />Zoomkat's meta-refresh test</title>");
          client.print("</head>");
          client.println("<BODY>");
          client.print("Zoomkat's meta-refresh test IDE 1.0");
          client.println("<br />");
                   
          client.print("page refresh number ");
          client.println(x); //current refresh count
          client.println("<br />");
          client.println("<br />");
         
          client.print("Zoomkat's arduino analog input values:");
          client.println("<br />");
          client.println("<br />");
         
          // output the value of each analog input pin
          for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
            client.print("analog input ");
            client.print(analogChannel);
            client.print(" is ");
            client.print(analogRead(analogChannel));
            client.println("<br />");
            }
           break;
          client.println("</BODY>");
          client.println("</HTML>");
         }
        }
    }
    // give the web browser time to receive the data
    delay(1);
    // close the connection:
    client.stop();
  }
}

12  Using Arduino / Networking, Protocols, and Devices / Re: Refreshing Web Site Without Resending Data? on: February 19, 2013, 11:08:45 pm
For all those looking to see this closed out, I simply used a Meta-refresh command set for 15 seconds. Works great and does not resend button presses.

Thanks for the help guys.

How do I use the Meta-refresh command in code? Thanks
13  Using Arduino / Networking, Protocols, and Devices / Re: Refreshing Web Site Without Resending Data? on: February 19, 2013, 11:07:58 pm
For all those looking to see this closed out, I simply used a Meta-refresh command set for 15 seconds. Works great and does not resend button presses.

Thanks for the help guys.

How do I use the Meta-refresh command in code? Thanks
14  Using Arduino / Networking, Protocols, and Devices / Re: Refreshing Web Site Without Resending Data? on: February 19, 2013, 10:13:28 pm
For all those looking to see this closed out, I simply used a Meta-refresh command set for 15 seconds. Works great and does not resend button presses.

Thanks for the help guys.

How do I use the Meta-refresh command in code? Thanks
15  Using Arduino / Programming Questions / Re: Webserver and timer functions on: February 19, 2013, 09:41:07 pm
Yes I did try that and the switch is being recognised but does not seem to be going into the interrupt function for the time. Below is what I tried to debug the problem: I have attached it because of the character limit. Thanks again

The forum is amazing
Pages: [1] 2