Skip to content
This repository has been archived by the owner on Nov 25, 2021. It is now read-only.

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
khoih-prog authored Dec 30, 2019
1 parent 880b65b commit 18cc63d
Show file tree
Hide file tree
Showing 11 changed files with 373 additions and 12 deletions.
153 changes: 153 additions & 0 deletions examples/AM2315_ESP8266/AM2315_ESP8266.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
/****************************************************************************************************************************
* AM2315_ESP8266.ino
* For ESP8266 boards
*
* Blynk_WM is a library for the ESP8266/ESP32 Arduino platform (https://github.com/esp8266/Arduino) to enable easy
* configuration/reconfiguration and autoconnect/autoreconnect of WiFi/Blynk
* Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
* Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM
* Licensed under MIT license
* Version: 1.0.2
*
* Original Blynk Library author:
* @file BlynkSimpleEsp8266.h
* @author Volodymyr Shymanskyy
* @license This project is released under the MIT License (MIT)
* @copyright Copyright (c) 2015 Volodymyr Shymanskyy
* @date Jan 2015
* @brief
*
* Version Modified By Date Comments
* ------- ----------- ---------- -----------
* 1.0.0 K Hoang 28/10/2019 Initial coding
* 1.0.1 K Hoang 28/10/2019 Add features
* 1.0.2 K Hoang 21/11/2019 Fix bug. Add features.
*****************************************************************************************************************************/

#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>

// Not use #define USE_SPIFFS => using EEPROM for configuration data in WiFiManager
// #define USE_SPIFFS false => using EEPROM for configuration data in WiFiManager
// #define USE_SPIFFS true => using SPIFFS for configuration data in WiFiManager
// Be sure to define USE_SPIFFS before #include <BlynkSimpleEsp8266_WM.h>

#define USE_SPIFFS true

//You have to download Blynk WiFiManager Blynk_WM library at //https://github.com/khoih-prog/Blynk_WM
// In order to enable (USE_BLYNK_WM = true). Otherwise, use (USE_BLYNK_WM = false)
#define USE_BLYNK_WM true
//#define USE_BLYNK_WM false

#define USE_SSL false

#if USE_BLYNK_WM
#if USE_SSL
#include <BlynkSimpleEsp8266_SSL_WM.h> //https://github.com/khoih-prog/Blynk_WM
#else
#include <BlynkSimpleEsp8266_WM.h> //https://github.com/khoih-prog/Blynk_WM
#endif
#else
#if USE_SSL
#include <BlynkSimpleEsp8266_SSL.h>
#define BLYNK_HARDWARE_PORT 9443
#else
#include <BlynkSimpleEsp8266.h>
#define BLYNK_HARDWARE_PORT 8080
#endif
#endif

#if !USE_BLYNK_WM
#define USE_LOCAL_SERVER true
//#define USE_LOCAL_SERVER false

// If local server
#if USE_LOCAL_SERVER
char blynk_server[] = "yourname.duckdns.org";
#endif

char auth[] = "***";
char ssid[] = "***";
char pass[] = "***";

#endif

#include <Wire.h>
#include <Adafruit_AM2315.h> // To install Adafruit AM2315 library

#define PIN_D1 5 // Pin D1 mapped to pin GPIO5/SCL of ESP8266
#define PIN_D2 4 // Pin D2 mapped to pin GPIO4/SDA of ESP8266

// Connect RED of the AM2315 sensor to 5.0V
// Connect BLACK to Ground
// Connect WHITE to i2c clock (PIN_D1 / SCL)
// Connect YELLOW to i2c data (PIN_D2 / SDA)

Adafruit_AM2315 AM2315;

#define AM2315_DEBUG true

BlynkTimer timer;

#define READ_INTERVAL 30000 //read AM2315 interval 30s

void ReadData()
{
static float temperature, humidity;

if (!AM2315.readTemperatureAndHumidity(&temperature, &humidity))
{
#if AM2315_DEBUG
Serial.println("Failed to read data from AM2315");
#endif

return;
}

#if AM2315_DEBUG
Serial.println("Temp *C: " + String(temperature));
Serial.println("Humid %: " + String(humidity));
#endif

//V1 and V2 are Blynk Display widgets' VPIN
Blynk.virtualWrite(V1, temperature);
Blynk.virtualWrite(V2, humidity);
}

void setup()
{
Serial.begin(115200);

Serial.println("\nStarting");

if (!AM2315.begin())
{
Serial.println("Sensor not found, check wiring & pullups!");
}

#if USE_BLYNK_WM
Blynk.begin();
#else
WiFi.begin(ssid, pass);

#if USE_LOCAL_SERVER
Blynk.config(auth, blynk_server, BLYNK_HARDWARE_PORT);
#else
Blynk.config(auth);
#endif

Blynk.connect();
#endif

if ( Blynk.connected())
Serial.println("Connected to Blynk");

timer.setInterval(READ_INTERVAL, ReadData);
}

void loop()
{
Blynk.run();
timer.run();
}
26 changes: 26 additions & 0 deletions examples/DHT11ESP32/DHT11ESP32.ino
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
/****************************************************************************************************************************
* DHT11ESP32.ino
* For ESP32 boards
*
* Blynk_WM is a library for the ESP8266/ESP32 Arduino platform (https://github.com/esp8266/Arduino) to enable easy
* configuration/reconfiguration and autoconnect/autoreconnect of WiFi/Blynk
* Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
* Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM
* Licensed under MIT license
* Version: 1.0.2
*
* Original Blynk Library author:
* @file BlynkSimpleEsp8266.h
* @author Volodymyr Shymanskyy
* @license This project is released under the MIT License (MIT)
* @copyright Copyright (c) 2015 Volodymyr Shymanskyy
* @date Jan 2015
* @brief
*
* Version Modified By Date Comments
* ------- ----------- ---------- -----------
* 1.0.0 K Hoang 28/10/2019 Initial coding
* 1.0.1 K Hoang 28/10/2019 Add features
* 1.0.2 K Hoang 21/11/2019 Fix bug. Add features.
*****************************************************************************************************************************/

#define BLYNK_PRINT Serial

// Not use #define USE_SPIFFS => using EEPROM for configuration data in WiFiManager
Expand Down
26 changes: 26 additions & 0 deletions examples/DHT11ESP32_SSL/DHT11ESP32_SSL.ino
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
/****************************************************************************************************************************
* DHT11ESP32_SSL.ino
* For ESP32 boards
*
* Blynk_WM is a library for the ESP8266/ESP32 Arduino platform (https://github.com/esp8266/Arduino) to enable easy
* configuration/reconfiguration and autoconnect/autoreconnect of WiFi/Blynk
* Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
* Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM
* Licensed under MIT license
* Version: 1.0.2
*
* Original Blynk Library author:
* @file BlynkSimpleEsp8266.h
* @author Volodymyr Shymanskyy
* @license This project is released under the MIT License (MIT)
* @copyright Copyright (c) 2015 Volodymyr Shymanskyy
* @date Jan 2015
* @brief
*
* Version Modified By Date Comments
* ------- ----------- ---------- -----------
* 1.0.0 K Hoang 28/10/2019 Initial coding
* 1.0.1 K Hoang 28/10/2019 Add features
* 1.0.2 K Hoang 21/11/2019 Fix bug. Add features.
*****************************************************************************************************************************/

#define BLYNK_PRINT Serial

// Not use #define USE_SPIFFS => using EEPROM for configuration data in WiFiManager
Expand Down
25 changes: 25 additions & 0 deletions examples/DHT11ESP8266/DHT11ESP8266.ino
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
/****************************************************************************************************************************
* DHT11ESP8266.ino
* For ESP8266 boards
*
* Blynk_WM is a library for the ESP8266/ESP32 Arduino platform (https://github.com/esp8266/Arduino) to enable easy
* configuration/reconfiguration and autoconnect/autoreconnect of WiFi/Blynk
* Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
* Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM
* Licensed under MIT license
* Version: 1.0.2
*
* Original Blynk Library author:
* @file BlynkSimpleEsp8266.h
* @author Volodymyr Shymanskyy
* @license This project is released under the MIT License (MIT)
* @copyright Copyright (c) 2015 Volodymyr Shymanskyy
* @date Jan 2015
* @brief
*
* Version Modified By Date Comments
* ------- ----------- ---------- -----------
* 1.0.0 K Hoang 28/10/2019 Initial coding
* 1.0.1 K Hoang 28/10/2019 Add features
* 1.0.2 K Hoang 21/11/2019 Fix bug. Add features.
*****************************************************************************************************************************/
// Not use #define USE_SPIFFS => using EEPROM for configuration data in WiFiManager
// #define USE_SPIFFS false => using EEPROM for configuration data in WiFiManager
// #define USE_SPIFFS true => using SPIFFS for configuration data in WiFiManager
Expand Down
26 changes: 26 additions & 0 deletions examples/DHT11ESP8266_Debug/DHT11ESP8266_Debug.ino
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
/****************************************************************************************************************************
* DHT11ESP8266_Debug.ino
* For ESP8266 boards
*
* Blynk_WM is a library for the ESP8266/ESP32 Arduino platform (https://github.com/esp8266/Arduino) to enable easy
* configuration/reconfiguration and autoconnect/autoreconnect of WiFi/Blynk
* Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
* Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM
* Licensed under MIT license
* Version: 1.0.2
*
* Original Blynk Library author:
* @file BlynkSimpleEsp8266.h
* @author Volodymyr Shymanskyy
* @license This project is released under the MIT License (MIT)
* @copyright Copyright (c) 2015 Volodymyr Shymanskyy
* @date Jan 2015
* @brief
*
* Version Modified By Date Comments
* ------- ----------- ---------- -----------
* 1.0.0 K Hoang 28/10/2019 Initial coding
* 1.0.1 K Hoang 28/10/2019 Add features
* 1.0.2 K Hoang 21/11/2019 Fix bug. Add features.
*****************************************************************************************************************************/

#define BLYNK_PRINT Serial

// Not use #define USE_SPIFFS => using EEPROM for configuration data in WiFiManager
Expand Down
26 changes: 26 additions & 0 deletions examples/DHT11ESP8266_SSL/DHT11ESP8266_SSL.ino
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
/****************************************************************************************************************************
* DHT11ESP8266_SSL.ino
* For ESP8266 boards
*
* Blynk_WM is a library for the ESP8266/ESP32 Arduino platform (https://github.com/esp8266/Arduino) to enable easy
* configuration/reconfiguration and autoconnect/autoreconnect of WiFi/Blynk
* Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
* Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM
* Licensed under MIT license
* Version: 1.0.2
*
* Original Blynk Library author:
* @file BlynkSimpleEsp8266.h
* @author Volodymyr Shymanskyy
* @license This project is released under the MIT License (MIT)
* @copyright Copyright (c) 2015 Volodymyr Shymanskyy
* @date Jan 2015
* @brief
*
* Version Modified By Date Comments
* ------- ----------- ---------- -----------
* 1.0.0 K Hoang 28/10/2019 Initial coding
* 1.0.1 K Hoang 28/10/2019 Add features
* 1.0.2 K Hoang 21/11/2019 Fix bug. Add features.
*****************************************************************************************************************************/

#define BLYNK_PRINT Serial

// Not use #define USE_SPIFFS => using EEPROM for configuration data in WiFiManager
Expand Down
26 changes: 26 additions & 0 deletions examples/ESP32WM_Config/ESP32WM_Config.ino
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
/****************************************************************************************************************************
* ESP32WM_Config.ino
* For ESP32 boards
*
* Blynk_WM is a library for the ESP8266/ESP32 Arduino platform (https://github.com/esp8266/Arduino) to enable easy
* configuration/reconfiguration and autoconnect/autoreconnect of WiFi/Blynk
* Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
* Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM
* Licensed under MIT license
* Version: 1.0.2
*
* Original Blynk Library author:
* @file BlynkSimpleEsp8266.h
* @author Volodymyr Shymanskyy
* @license This project is released under the MIT License (MIT)
* @copyright Copyright (c) 2015 Volodymyr Shymanskyy
* @date Jan 2015
* @brief
*
* Version Modified By Date Comments
* ------- ----------- ---------- -----------
* 1.0.0 K Hoang 28/10/2019 Initial coding
* 1.0.1 K Hoang 28/10/2019 Add features
* 1.0.2 K Hoang 21/11/2019 Fix bug. Add features.
*****************************************************************************************************************************/

#define BLYNK_PRINT Serial

// Not use #define USE_SPIFFS => using EEPROM for configuration data in WiFiManager
Expand Down
26 changes: 26 additions & 0 deletions examples/ESP8266WM_Config/ESP8266WM_Config.ino
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
/****************************************************************************************************************************
* ESP8266WM_Config.ino
* For ESP8266 boards
*
* Blynk_WM is a library for the ESP8266/ESP32 Arduino platform (https://github.com/esp8266/Arduino) to enable easy
* configuration/reconfiguration and autoconnect/autoreconnect of WiFi/Blynk
* Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
* Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM
* Licensed under MIT license
* Version: 1.0.2
*
* Original Blynk Library author:
* @file BlynkSimpleEsp8266.h
* @author Volodymyr Shymanskyy
* @license This project is released under the MIT License (MIT)
* @copyright Copyright (c) 2015 Volodymyr Shymanskyy
* @date Jan 2015
* @brief
*
* Version Modified By Date Comments
* ------- ----------- ---------- -----------
* 1.0.0 K Hoang 28/10/2019 Initial coding
* 1.0.1 K Hoang 28/10/2019 Add features
* 1.0.2 K Hoang 21/11/2019 Fix bug. Add features.
*****************************************************************************************************************************/

#define BLYNK_PRINT Serial

// Not use #define USE_SPIFFS => using EEPROM for configuration data in WiFiManager
Expand Down
17 changes: 13 additions & 4 deletions src/BlynkSimpleEsp32_SSL_WM.h
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
/**
/****************************************************************************************************************************
* BlynkSimpleEsp32_SSL_WM.h
* For ESP32 boards
*
* Blynk_WM is a library for the ESP8266/ESP32 Arduino platform (https://github.com/esp8266/Arduino) to enable easy
* configuration/reconfiguration and autoconnect/autoreconnect of WiFi/Blynk
* Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
* Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM
* Licensed under MIT license
* Version: 1.0.2
*
* Original Blynk Library author:
* @file BlynkSimpleEsp32_SSL.h
* @file BlynkSimpleEsp8266.h
* @author Volodymyr Shymanskyy
* @license This project is released under the MIT License (MIT)
* @copyright Copyright (c) 2015 Volodymyr Shymanskyy
* @date Dec 2017
* @date Jan 2015
* @brief
*
*/
* Version Modified By Date Comments
* ------- ----------- ---------- -----------
* 1.0.0 K Hoang 28/10/2019 Initial coding
* 1.0.1 K Hoang 28/10/2019 Add features
* 1.0.2 K Hoang 21/11/2019 Fix bug. Add features.
*****************************************************************************************************************************/

#ifndef BlynkSimpleEsp32_SSL_WM_h
#define BlynkSimpleEsp32_SSL__WMh
Expand Down
Loading

0 comments on commit 18cc63d

Please sign in to comment.