Created
May 24, 2020 00:57
-
-
Save drifterz28/c2ecfb414f6d4c8d50dfe6c9dceaf699 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Arduino.h> | |
#include <ESP8266WiFi.h> | |
#include <Adafruit_NeoPixel.h> | |
#include <time.h> | |
#include <ArduinoJson.h> | |
#define LED 2 | |
#define LED_COUNT 22 | |
#define APP_ID "ff6f5d189dfa1eba10cc3559a7eb097d" | |
#define ZIP "97701" | |
#define ON_TIME 600 | |
#define OFF_TIME 1600 | |
boolean IS_METRIC = true; | |
//http://api.openweathermap.org/data/2.5/weather?zip=97701&appid=ff6f5d189dfa1eba10cc3559a7eb097d | |
const char* ESP_HOST_NAME = "esp-" + ESP.getFlashChipId(); | |
const char* ssid = "empire-2.4"; | |
const char* password = "password"; | |
int timezone = -9 * 3600; | |
int dst = 0; | |
WiFiClient wifiClient; | |
void connectWifi() { | |
WiFi.begin(ssid, password); | |
Serial.print("Connecting to "); | |
Serial.println(ssid); | |
while (WiFi.status() != WL_CONNECTED) { | |
delay(500); | |
Serial.print("."); | |
} | |
Serial.println(""); | |
Serial.print("WiFi connected: "); | |
Serial.println(WiFi.localIP()); | |
} | |
void setup() { | |
Serial.begin(115200); | |
Serial.println("started"); | |
connectWifi(); | |
configTime(timezone, dst, "pool.ntp.org","time.nist.gov"); | |
} | |
void loop() { | |
Serial.println("started"); | |
delay(5000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment