arduino+ethernet

#define BLYNK_PRINT Serial #include <SPI.h> #include <Ethernet.h> #include <BlynkSimpleEthernet.h> // You should get Auth Token in the Blynk App. // Go to the Project Settings (nut icon). char auth[] = "56a2adc29c054c76ba500d2ee36bae45"; #define W5100_CS 10 #define SDCARD_CS 4 // network configuration. dns server, gateway and subnet are optional. // the media access control (ethernet hardware) address for the shield: byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; // the dns server ip IPAddress dnServer(192, 168, 1, 1); // the router's gateway address: IPAddress gateway(192, 168, 1, 1); // the subnet: IPAddress subnet(255, 255, 255, 0); //the IP address is dependent on your network IPAddress ip(192, 168, 1, 222); void setup() { // Debug console Serial.begin(9600); // initialize the ethernet device Ethernet.begin(mac, ip, dnServer, gateway, subnet); //print out the IP address Serial.print("IP = "); Serial.println(Ethernet.localIP()); pinMode(SDCARD_CS, OUTPUT); digitalWrite(SDCARD_CS, HIGH); // Deselect the SD card // Blynk.begin(auth); // You can also specify server: Blynk.begin(auth, "blynk.iot-cm.com", 8080); //Blynk.begin(auth, "blynk-cloud.com", 80); //Blynk.begin(auth, IPAddress(192,168,1,100), 8080); // For more options, see Boards_Ethernet/Arduino_Ethernet_Manual example } void loop() { Blynk.run(); }

https://www.arduino.cc/en/Guide/ArduinoEthernetShield

#include <SPI.h> #include <Ethernet.h> #include "plotly_streaming_ethernet.h" #include "DHT.h" // Sign up to plotly here: https://plot.ly // View your API key and streamtokens here: https://plot.ly/settings #define nTraces 2 // View your tokens here: https://plot.ly/settings // Supply as many tokens as data traces // e.g. if you want to ploty A0 and A1 vs time, supply two tokens char *tokens[nTraces] = {"25tm9197rz", "unbi52ww8a"}; // arguments: username, api key, streaming token, filename plotly graph("workshop", "v6w5xlbx9j", tokens, "filename", nTraces); // DHT Sensor Setup #define DHTPIN 2 // We have connected the DHT to Digital Pin 2 #define DHTTYPE DHT22 // This is the type of DHT Sensor (Change it to DHT11 if you're using that model) DHT dht(DHTPIN, DHTTYPE); // Initialize DHT object byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; byte my_ip[] = { 199, 168, 222, 18 }; // google will tell you: "public ip address" void startEthernet(){ Serial.println("... Initializing ethernet"); if(Ethernet.begin(mac) == 0){ Serial.println("... Failed to configure Ethernet using DHCP"); // no point in carrying on, so do nothing forevermore: // try to congifure using IP address instead of DHCP: Ethernet.begin(mac, my_ip); } Serial.println("... Done initializing ethernet"); delay(1000); } void setup() { graph.maxpoints = 100; // Open serial communications and wait for port to open: Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only } startEthernet(); bool success; success = graph.init(); if(!success){while(true){}} graph.openStream(); dht.begin(); } float h, t; void loop() { h = dht.readHumidity(); t = dht.readTemperature(); graph.plot(millis(), t, tokens[0]); graph.plot(millis(), h, tokens[1]); }