//-TheAmplituhedron.com //-Cloud System //-Sending data to TheAmplituhedron.com // //-By Kutluhan Aktar // // * For more information, please go to https://www.theamplituhedron.com/dashboard/cloud/ // * This an example code file for Arduino Ethernet Shield 2 or ENC28J60. // * Do not forget to use percent-encoding reserved characters for the header. // * Circuit: // * Ethernet shield attached to pins 10, 11, 12, 13 #include #include byte mac[0xDE,0xAD,0xBE,0xEF,0xFE,0xED] = { // Your MAC address has to be here. }; IPAddress ip(192,168,0,177); // A valid IP address to make an HTTP request. // Initialize the Ethernet server library // with the IP address and port you want to use // (port 80 is default for HTTP): EthernetServer server(80); // Define the sensors variables and types. int Sensor_1; String Sensor_2; char Sensor_3; float Sensor_4; String Sensor_5; char Sensor_6; void setup() { // Open serial communications and wait for port to open: Serial.begin(9600); // Start the Ethernet connection and the server: Ethernet.begin(mac, ip); server.begin(); Serial.print("server is at "); Serial.println(Ethernet.localIP()); } void loop() { // Attach whatever data you want to send TheAmplituhedron.com Sensor_1 = 100; Sensor_2 = "testString(1)"; Sensor_3 = 'C'; Sensor_4 = 123.456; Sensor_5 = "testString(2)"; Sensor_6 = 'A'; // Listen for incoming clients EthernetClient client = server.available(); if (client) { Serial.println("new client"); // An http request ends with a blank line boolean currentLineIsBlank = true; while (client.connected()) { if (client.available()) { char c = client.read(); Serial.println(readString); // If the line ends, initial a HTTP Request. if (c == '\n') { // send a standard http response header client.println("HTTP/1.1 200 OK");; client.println("Content-Type:text/html"); client.println("Connection: close"); // the connection will be closed after completion of the response client.println(); client.println(""); client.println(""); client.println(""); client.println("DeviceSide"); // Header for the web page. client.println(""); // Describe the name and icon of DeviceSide. client.println(""); client.println(""); // The hedron must be send with the get method. client.println("
"); // Enter your cloud page address. *Hedron here when the post method is active. client.println("
"); // *Hedron here when the get method is active. client.println(""); // When the DeviceSide button is clicked, the information is sent to TheAmplituhedron.com by the valid IP address. client.println("
"); client.println("
"); client.println("
"); client.println("
"); client.println("
"); client.println("
"); client.println("
"); client.println(""); client.println(""); break; } } } delay(1); // Close the connection: client.stop(); } }