Hi,
I want to sent an Email via IFTTT with my Arduino and the EthernetShield. I tried to do it with the following Code but it wont trigger my Event.
It is just a Test-Code for sending one Email.
My Pinout is:
ENC28J60 Modul Arduino Uno
5V 5V
GND GND
SCK PIN 13
SO PIN 12
ST PIN 11
CS PIN 10
RST RESET
#include <UIPEthernet.h>
EthernetClient client;
uint8_t mac[6] = {0x00,0x01,0x02,0x03,0x04,0x05};
char server[] = "maker.ifttt.com";
int t = 10;
int h = 50;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
if(Ethernet.begin(mac) == 0){
Serial.println("Failed to configure Ethernet using DHCP");
while(1); // kein Netzwerk? Dann Ende!
}
if(client.connect(server,80)) {
client.print("GET /trigger/Tmp/with/key/Vq****************?value1=");
client.print(t);
client.print("&value2=");
client.print(h);
client.println(" HTTP/1.1");
client.println("Host: maker.ifttt.com");
client.println();
}
else{
Serial.println("Connection to server failed");
delay(5000);
}
}
void loop() {
// put your main code here, to run repeatedly:
}
I did it like this but there is no other Output than "Connected to server"
#include <UIPEthernet.h>
#include "utility/logging.h"
EthernetClient client;
uint8_t mac[6] = {0x00,0x01,0x02,0x03,0x04,0x05};
char server[] = "maker.ifttt.com";
int t = 10;
int h = 50;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
if(Ethernet.begin(mac) == 0){
Serial.println("Failed to configure Ethernet using DHCP");
while(1); // kein Netzwerk? Dann Ende!
}
if(client.connect(server,80))
{
Serial.println("Connected to server");
client.print("GET /trigger/Tmp/with/key/VqTnw5WtC6mDlL5tmd6Fr?value1=");
client.print(t);
client.print("&value2=");
client.print(h);
client.println(" HTTP/1.1");
client.println("Host: maker.ifttt.com");
client.println();
while(client.connected())
{
if(client.available())
{
// read an incoming byte from the server and print it to serial monitor:
char c = client.read();
Serial.print(c);
}
}
client.stop();
Serial.println();
Serial.println("disconnected");
}
else
{
Serial.println("Connection to server failed");
delay(5000);
}
}
void loop() {
// put your main code here, to run repeatedly:
}
No, there is no way to handle a HTTPS connection (which require SSL encryption) with a such low computational power MCU, at least as far as I'm aware.
You need a different board.
WiFi shields and modules can do secure connection. of course Ethernet modules with secure connection support exist too, but there is no Arduino library for them. for example ENC424J600
esp8266 is used most because it is cheap. it communicates over Serial and usually causes troubles for beginners. I wrote the WiFiEspAT library for using esp8266 as WiFi shield.
Adaruit ATWNC1500 shields and modules use SPI and are reliable. they are derivatives of the Arduino WiFi 101 shield design and are used with the Arduino WiFi101 library.
both libraries are very similar to the Ethernet library