Skip to content

Instantly share code, notes, and snippets.

View VladVanyuk's full-sized avatar
🎯
Doing so much, for so long, with so little

Vladislav Vanyuk VladVanyuk

🎯
Doing so much, for so long, with so little
View GitHub Profile
@VladVanyuk
VladVanyuk / scada.ino
Created November 15, 2025 23:00
scada lab
#include <Arduino.h>
#include <DHT11.h>
#include <Wire.h>
#include <BME280I2C.h>
// #include <ESP8266WiFi.h>
// #include <MQTT.h>
#define MOTOR_INA_PIN D5
#define MOTOR_INB_PIN D6
#define DHT_SENSOR_PIN D7
@VladVanyuk
VladVanyuk / serialEvent.cpp
Created July 15, 2025 08:53
serialEvent handler
void serialEvent() {
while (Serial.available()) {
// get the new byte:
char inChar = (char)Serial.read();
// add it to the inputString:
inputString += inChar;
// if the incoming character is a newline, set a flag so the main loop can
// do something about it:
if (inChar == '\n') {
stringComplete = true;
@VladVanyuk
VladVanyuk / hc-12-setup.ino
Last active July 4, 2025 01:40
Put the HC12 is config mode, send a given command and display the result
#include "Arduino.h"
#include "SoftwareSerial.h"
#define INIT_BPS (9600)
#define WORK_BPS (38400)
#ifdef ARDUINO_AVR_UNO
#define HC12RX (7)
#define HC12TX (6)
#define HC12SET (5)
@VladVanyuk
VladVanyuk / scanI2CBus.ino
Created December 27, 2024 17:00
scanI2CBus with callback function
#include "Wire.h"
extern "C" {
#include "utility/twi.h"
}
void scanI2CBus(byte from_addr, byte to_addr, void(*callback)(byte address, byte result) )
{
byte rc;
byte data = 0;
@VladVanyuk
VladVanyuk / SerialLog.h
Created November 4, 2024 11:32
Serial logs for esp
#ifndef __SERIALLOG_H__
#define __SERIALLOG_H__
#include <stdio.h>
#include <string.h>
#ifdef __cplusplus
extern "C"
{
#endif
@VladVanyuk
VladVanyuk / Makefile
Created November 3, 2024 20:31
mdns-access-point esp8266
.PHONY: lint compile upload clean
lint:
cpplint --extensions=ino --filter=-legal/copyright,-readability/todo *.ino
compile:
arduino-cli compile --fqbn esp8266com:esp8266:d1_mini ./
upload: compile
arduino-cli upload -p /dev/cu.wchusbserial1410 --fqbn esp8266com:esp8266:d1_mini ./
@VladVanyuk
VladVanyuk / ESP_FS_INC.h
Created November 1, 2024 21:28
esp FS macro
#if defined USE_SPIFFS
#include <FS.h>
const char* fsName = "SPIFFS";
FS* fileSystem = &SPIFFS;
SPIFFSConfig fileSystemConfig = SPIFFSConfig();
#elif defined USE_LITTLEFS
#include <LittleFS.h>
const char* fsName = "LittleFS";
FS* fileSystem = &LittleFS;
LittleFSConfig fileSystemConfig = LittleFSConfig();
@VladVanyuk
VladVanyuk / LCD_PINS.h
Created September 13, 2024 22:13
esp32 gpio struct for LCD_PINS_T
typedef struct {
union {
struct {
gpio_num_t D0, D1, D2, D3, D4, D5, D6, D7;
gpio_num_t RS, EN;
} gpio;
struct {
i2c_port_t port;
uint8_t address;
@VladVanyuk
VladVanyuk / special_chars.h
Created September 13, 2024 22:06
ASCII special chars
#pragma once
const char LCD_ALPHA = 0xE0;
const char LCD_BETA = 0xE2;
const char LCD_EPSILON = 0xE3;
const char LCD_MU = 0xE4;
const char LCD_RHO = 0xE5;
const char LCD_SQROOT = 0xE7;
const char LCD_THETA = 0xF2;
@VladVanyuk
VladVanyuk / ESP8266_rtc.h
Created July 24, 2024 15:32
esp8266 rtc util
#pragma once
#include <Arduino.h>
#ifdef ESP8266
#define RTCU_ERROR 0
#define RTCU_READ 1
#define RTCU_RESET 2
template <typename T>