Skip to content

Commit

Permalink
Merge pull request #138 from lakshithaKaveen/main
Browse files Browse the repository at this point in the history
Update PIR_WiFi_ESP.ino
  • Loading branch information
lakshithaKaveen authored Jan 28, 2024
2 parents 445a61d + d9018c0 commit 90c5cf3
Showing 1 changed file with 6 additions and 100 deletions.
106 changes: 6 additions & 100 deletions code/Stationary Objects/PIR_WiFi_ESP/PIR_WiFi_ESP.ino
Original file line number Diff line number Diff line change
Expand Up @@ -4,110 +4,24 @@
#include <ArduinoJson.h>

// WiFi credentials
const char* ssid = "SLT-4G_166F33";
const char* password = "F568A2FF";
const char* ssid = "";
const char* password = "";

// AWS IoT credentials
const char* aws_endpoint = "a2leuqp8y2i70g-ats.iot.ap-southeast-1.amazonaws.com"; // Your AWS IoT endpoint
const char* aws_topic = "pir/1/pub"; // Your MQTT topic
const char* aws_endpoint = ""; // Your AWS IoT endpoint
const char* aws_topic = ""; // Your MQTT topic

// Certificates and private key
const char* root_ca = R"EOF(
-----BEGIN CERTIFICATE-----
MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsF
ADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6
b24gUm9vdCBDQSAxMB4XDTE1MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTEL
MAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJv
b3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALJ4gHHKeNXj
ca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgHFzZM
9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qw
IFAGbHrQgLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6
VOujw5H5SNz/0egwLX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+bCFAoGBAK1+
bcroD/kqH8M9FFrNxiLywTRyfo+DPPVPOZm+l4drXPDktsfjdpUC8pI1ZXqO1G7s
GzzPcjGWeUHnddaWL1lT+zve6/wkv8MoibXD54zWCp99h/lsqewnU5/WrSoG27Hq
AIe5Tmo4UNZDCLbFn1CclDOUedTYwQO8rc9O46JxAoGAfM5eRhFXrNa3lhEbmUwx
z5RyL3oSYCbz0KtLBQsqlv0sSs86VpsKvHa4Me+J59eToHcg7GuND8oWiZVguN1R
iW9kxyAEkV7mzP4qBQavHVs+NfZNFJm075m3sw+Iy6pqhEiclqAQjsazdRWpDVBF
SRiCztwU/bjhzySR+2I/f2c=
-----END PRIVATE KEY-----
)KEY";

WiFiClientSecure wifiClient;
Expand Down Expand Up @@ -219,11 +133,3 @@ String displayWiFiNetworks() {
return jsonStr;
}
}








0 comments on commit 90c5cf3

Please sign in to comment.