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
//#use spi(FORCE_HW,master,baud = 10000000, BITS=8,MSB_FIRST, stream = RFID, ENABLE_ACTIVE=0)// uses hardware SPI and gives this stream the name SPI_STREAM | |
//MF522 Command word | |
#define PCD_IDLE 0x00 //NO action; Cancel the current command | |
#define PCD_AUTHENT 0x0E //Authentication Key | |
#define PCD_RECEIVE 0x08 //Receive Data | |
#define PCD_TRANSMIT 0x04 //Transmit data | |
#define PCD_TRANSCEIVE 0x0C //Transmit and receive data, | |
#define PCD_RESETPHASE 0x0F //Reset | |
#define PCD_CALCCRC 0x03 //CRC Calculate | |
// Mifare_One card command word |
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 <ex_usb_common.h> | |
#define MPU_SDA PIN_E0 | |
#define MPU_SCL PIN_E1 | |
#use I2C(master, sda=MPU_SDA, scl=MPU_SCL) | |
#use TIMER(TIMER=1, TICK=1ms, BITS=16, NOISR) | |
#define RAD_TO_DEG 180/PI | |
#define LCD_ENABLE_PIN PIN_D2 | |
#define LCD_RS_PIN PIN_D0 | |
#define LCD_RW_PIN PIN_D1 | |
#define LCD_DATA4 PIN_D4 |
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
//**************************************************************// | |
// Name : 16Relay control via MQTT // | |
// Author : Son Bui-Mualinhkien.vn // | |
// Date : 23 March, 2016 // | |
// Version : 1.0 // | |
// Notes : Code for using a 74HC595 Shift Register // | |
// : Change Maximum packet size on pubsubclient lib to 512 bytes | |
// : https://play.google.com/store/apps/details?id=org.ngoinhaso.app.mqtthomecontrol //App UI | |
//**************************************************************// |
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
const int ledPin = 16; | |
const int ledPin2 = 17; | |
const int ledPin3 = 5; | |
// setting PWM properties | |
const int freq = 5000; | |
const int ledChannel = 0; | |
const int resolution = 8; | |
void setup() { |
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 |
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
<!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 "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
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" | |
#include "SPIFFS.h" | |
// Replace with your network credentials | |
const char* ssid = "Xuong May Tran Bam"; | |
const char* password = "123456789"; | |
// Set LED GPIO |