diff --git a/arduino/sketch.ino b/arduino/sketch.ino deleted file mode 100644 index e69de29..0000000 diff --git a/arduino/sketch_oct01a/sketch_oct01a.ino b/arduino/sketch_oct01a/sketch_oct01a.ino index 9bc0c37..5415f08 100644 --- a/arduino/sketch_oct01a/sketch_oct01a.ino +++ b/arduino/sketch_oct01a/sketch_oct01a.ino @@ -1,8 +1,8 @@ #include #include -char SSID[] = "OnePlus 6T"; // the name of your network/HotSpot -char PASSWORD[] = "linsey69"; // the password of your WiFi +char SSID[] = "SOTON-IoT"; // the name of your network/HotSpot +char PASSWORD[] = "c0YhM1lf8v88"; // the password of your WiFi byte mac[6]; // the MAC address of your Wifi Module diff --git a/arduino/sketch_oct01b/sketch_oct01b.ino b/arduino/sketch_oct01b/sketch_oct01b.ino new file mode 100644 index 0000000..fda29c5 --- /dev/null +++ b/arduino/sketch_oct01b/sketch_oct01b.ino @@ -0,0 +1,52 @@ +#include + +char ssid[] = "SOTON-IoT"; +char pass[] = "c0YhM1lf8v88"; +int status = WL_IDLE_STATUS; + +int HTTP_PORT = 443; +String HTTP_METHOD = "GET"; +char HOST_NAME[] = "example.phpoc.com"; +String PATH_NAME = ""; + +WiFiSSLClient client; + + +void setup() { + Serial.begin(9600); + while (!Serial); + while (status != WL_CONNECTED) { + Serial.print("Attempting to connect to network: "); + Serial.println(ssid); + status = WiFi.begin(ssid, pass); + delay(5000); + } + + Serial.println("Connected"); + if(client.connectSSL(HOST_NAME, HTTP_PORT)) { + Serial.println("Connected to server"); + client.println(HTTP_METHOD + " " + PATH_NAME + " HTTP/1.1"); + client.println("Host: " + String(HOST_NAME)); + client.println("Connection: close"); + client.println(); + while(client.available()) +{ + // read an incoming byte from the server and print them to serial monitor: + char c = client.read(); + Serial.println(c); + Serial.println("here"); +} + +if(!client.connected()) +{ + Serial.println("disconnected"); + client.stop(); +} + } else { + Serial.println("connection failed"); + } +} + +void loop() { + +}