Skip to content

Instantly share code, notes, and snippets.

#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <Hash.h>
#include <ESPAsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include <Adafruit_Sensor.h>
#include <DHT.h>
const char* ssid = "ESP8266-Access-Point";
const char* password = "123456789";
#define DHTPIN 5 // Digital pin connected to the DHT sensor
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
//SSID and Password to your ESP Access Point
const char* ssid = "ESPWebServer";
const char* password = "12345678";
ESP8266WebServer server(80); //Server on port 80
With help of program you can connect to WIFI module
#include "ESP8266WiFi.h"
const char* ssid = "ssid"; //Enter SSID
const char* password = "password"; //Enter Password
void setup(void)
{
Serial.begin(115200);
// Connect to WiFi
WiFi.begin(ssid, password);
#include "sys/time.h"
#include "BLEDevice.h"
#include "BLEServer.h"
#include "BLEUtils.h"
#include "esp_sleep.h"
#define GPIO_DEEP_SLEEP_DURATION 1 // sleep 4 seconds and then wake up
RTC_DATA_ATTR static time_t last; // remember last boot in RTC Memory
RTC_DATA_ATTR static uint32_t bootcount; // remember number of boots in RTC Memory
#ifdef __cplusplus
extern "C" {
Callback function and sendmessage function file
static void sendCallback(IOTHUB_CLIENT_CONFIRMATION_RESULT result, void *userContextCallback)
{
if (IOTHUB_CLIENT_CONFIRMATION_OK == result)
{
(void)printf("Message sent to Azure IoT Hub.");
}
else
{
(void)printf("Failed to send message to Azure IoT Hub.");
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#ifndef IOT_CONFIGS_H
#define IOT_CONFIGS_H
#define DEVICE_ID "<Give your Deviceid here>"
// Interval time(ms) for sending message to IoT Hub
#define INTERVAL 2000
#include <ESP8266WiFi.h>
#include <AzureIoTHub.h>
#include <AzureIoTProtocol_MQTT.h>
#include <AzureIoTUtility.h>
#include <ArduinoJson.h>
#include "dht_temperature_AzureIotHub_config.h"
#include "DHT.h"
#define DHTPIN D1 // what digital pin we're connected to
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_CAP1188.h>
// Reset Pin is used for I2C or SPI
#define CAP1188_RESET 9
// CS pin is used for software or hardware SPI
#define CAP1188_CS 10
@Avotrix
Avotrix / HomeAutomationusingESP8266.ino
Created July 7, 2020 15:40
Home Automation using ESP8266
//by Avotrix
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <UniversalTelegramBot.h>
char ssid[] = "YOUR_WIFI_SSID";
char password[] = "YOUR_PASSWORD";
#define BOTtoken "YOUR_TELEGRAM_TOKEN"; //Bot Token Telegram
WiFiClientSecure client;
@Avotrix
Avotrix / Firebase.ino
Created June 29, 2020 17:17
Firebase controlled LED using NodeMCU
#include "FirebaseESP8266.h"
#include <ESP8266WiFi.h>
#include <Adafruit_NeoPixel.h>
#define PIN 5
#define NUM_LEDS 1
const char* ssid = "XXXXXX";
const char* password = "XXXXXXX";
FirebaseData firebaseData;
Adafruit_NeoPixel leds(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800);
// Current color values