Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <ESP8266HTTPClient.h>
- #include <SimpleButton.h>
- using namespace simplebutton;
- #include <ESP8266WiFi.h>
- HTTPClient http;
- const char* ssid = "JWSystems";
- const char* password = "jamescool192";
- Button* b = NULL;
- void setup() {
- b = new Button(0);
- Serial.begin(115200);
- delay(10);
- // We start by connecting to a WiFi network
- Serial.println();
- Serial.println();
- Serial.print("Connecting to ");
- Serial.println(ssid);
- WiFi.begin(ssid, password);
- while (WiFi.status() != WL_CONNECTED) {
- delay(500);
- Serial.print(".");
- }
- Serial.println("");
- Serial.println("WiFi connected");
- Serial.println("IP address: ");
- Serial.println(WiFi.localIP());
- }
- int value = 0;
- void loop() {
- b->update();
- if (b->clicked()) {
- Serial.println("BUTTON");
- http.begin("http://doorpi.lan/api");
- http.POST("username=api&password=q8tFpTn9gxvs&type=5sec");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement