-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Created secure ESP32 example #12
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#include <WiFiClientSecure.h> | ||
#include <Pushover.h> | ||
|
||
const char* ssid = ""; // your network SSID (name of wifi network) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why so many spaces? |
||
const char* password = ""; // your network password | ||
const char* userToken = ""; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If using extra spaces, please align all evenly. |
||
const char* appToken = ""; | ||
|
||
const char* test_root_ca= \ | ||
"-----BEGIN CERTIFICATE-----\n" \ | ||
"MIIEsTCCA5mgAwIBAgIQCKWiRs1LXIyD1wK0u6tTSTANBgkqhkiG9w0BAQsFADBh\n" \ | ||
"MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3\n" \ | ||
"d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD\n" \ | ||
"QTAeFw0xNzExMDYxMjIzMzNaFw0yNzExMDYxMjIzMzNaMF4xCzAJBgNVBAYTAlVT\n" \ | ||
"MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j\n" \ | ||
"b20xHTAbBgNVBAMTFFJhcGlkU1NMIFJTQSBDQSAyMDE4MIIBIjANBgkqhkiG9w0B\n" \ | ||
"AQEFAAOCAQ8AMIIBCgKCAQEA5S2oihEo9nnpezoziDtx4WWLLCll/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ZN18bOGSGStoEc/JE4ocIzr8P5Mg11kRYHbmgYnr1Rxeki5mSeb39DGxTpJD4kG\n" \ | ||
"hs5lXNoo4conUiiJwKaqH7vh2baryd8pMISag83JUqyVGc2tWPpO0329/CWq2kry\n" \ | ||
"qv66OSMjwulUz0dXf4OHQasR7CNfIr+4KScc6ABlQ5RDF86PGeE6kdwSQkFiB/cQ\n" \ | ||
"ysNyq0jEDQTkfa2pjmuWtMCNbBnhFXBYejfubIhaUbEv2FOQB3dCav+FPg5eEveX\n" \ | ||
"TVyMnGo=\n" \ | ||
"-----END CERTIFICATE-----\n"; | ||
WiFiClientSecure client; | ||
void setup() { | ||
Serial.begin(115200); | ||
Serial.print("Attempting to connect to SSID: "); | ||
Serial.println(ssid); | ||
WiFi.begin(ssid, password); | ||
|
||
// attempt to connect to Wifi network: | ||
while (WiFi.status() != WL_CONNECTED) { | ||
Serial.print("."); | ||
// wait 1 second for re-trying | ||
delay(1000); | ||
} | ||
Comment on lines
+41
to
+50
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrong indentation |
||
while (WiFi.status() != WL_CONNECTED) delay(50); | ||
Serial.println("Connected"); | ||
client.setCACert(test_root_ca); | ||
Pushover po = Pushover(appToken,userToken, SAFE); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SAFE can be left out, as it's the default value. |
||
po.setDevice("device1"); | ||
po.setMessage("Testnotification"); | ||
po.setSound("bike"); | ||
Serial.println(po.send()); //should return 1 on success | ||
} | ||
|
||
void loop() { | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you commenting out this? Please use preprocessor instructions.