This file contains hidden or 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
String prepairData() { | |
int temperatureAdc = analogRead(SENSOR); | |
byte adcH = (temperatureAdc & 0xFF00) >> 8; | |
byte adcL = (temperatureAdc & 0x00FF); | |
byte inputstate = digitalRead(INP); | |
DebugSerial.print("<Adc:"); | |
DebugSerial.print(temperatureAdc); | |
DebugSerial.print(">"); | |
DebugSerial.print("<input:"); |
This file contains hidden or 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 <BLEDevice.h> | |
#include <BLEServer.h> | |
#include <BLEUtils.h> | |
#include <BLE2902.h> | |
BLEServer* pServer = NULL; | |
BLECharacteristic* pCharacteristic = NULL; | |
bool deviceConnected = false; | |
bool oldDeviceConnected = false; |
This file contains hidden or 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 <WiFi.h> | |
#include <MQTT.h> | |
const char ssid[] = "ssid"; | |
const char password[] = "pass"; | |
WiFiClient net; | |
MQTTClient client; |
This file contains hidden or 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 "WiFi.h" | |
#include "ESPAsyncWebServer.h" | |
const char* ssid = "Xuong May Gia Si";//"yourNetworkName"; | |
const char* password = "123456789";// "yourNetworkPassword"; | |
AsyncWebServer server(80); | |
AsyncWebSocket ws("/ws"); | |
void onWsEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventType type, void * arg, uint8_t *data, size_t len){ |
This file contains hidden or 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 "WiFi.h" | |
#include "ESPAsyncWebServer.h" | |
#include "SPIFFS.h" | |
// Replace with your network credentials | |
const char* ssid = "Xuong May Tran Bam"; | |
const char* password = "123456789"; | |
// Set LED GPIO |
This file contains hidden or 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
AsyncResponseStream *response = request->beginResponseStream("text/html"); | |
response->addHeader("Server","ESP Async Web Server"); | |
response->printf("<!DOCTYPE html><html><head><title>Webpage at %s</title></head><body>", request->url().c_str()); | |
response->print("<h2>Hello "); | |
response->print(request->client()->remoteIP()); | |
response->print("</h2>"); | |
response->print("<h3>General</h3>"); | |
response->print("<ul>"); |
This file contains hidden or 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 "WiFi.h" | |
#include "ESPAsyncWebServer.h" | |
const char* ssid = "yourNetworkName"; | |
const char* password = "yourNetworkPass"; | |
AsyncWebServer server(80); | |
void setup(){ | |
Serial.begin(115200); |
This file contains hidden or 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
<!DOCTYPE html> <html> | |
<head><meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> | |
<title>LED Control</title> | |
<style>html { font-family: Helvetica; display: inline-block; margin: 0px auto; text-align: center;} | |
body{margin-top: 50px;} h1 {color: #444444;margin: 50px auto 30px;} h3 {color: #444444;margin-bottom: 50px;} | |
.button {display: block;width: 80px;background-color: #3498db;border: none;color: white;padding: 13px 30px;text-decoration: none;font-size: 25px;margin: 0px auto 35px;cursor: pointer;border-radius: 4px;} | |
.button-on {background-color: #3498db;} | |
.button-on:active {background-color: #2980b9;} | |
.button-off {background-color: #34495e;} | |
.button-off:active {background-color: #2c3e50;} |
This file contains hidden or 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 <WiFi.h> | |
#include <HTTPClient.h> | |
const char* ssid = "Xuong May Tran Bam"; | |
const char* password = "123456789"; | |
void setup() { | |
Serial.begin(115200); | |
WiFi.begin(ssid, password); | |
while (WiFi.status() != WL_CONNECTED) { |
This file contains hidden or 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 "esp_system.h" | |
#include "esp_adc_cal.h" | |
#include "driver/adc.h" | |
#define ADC_BAT_PIN 34 | |
#define NO_OF_SAMPLES 64 //Multisampling | |
#define REF_VOLTAGE 1100 | |
#define LIN_COEFF_A_SCALE 65536 |
NewerOlder