Skip to content

Instantly share code, notes, and snippets.

View fxprime's full-sized avatar

Modulemore ขายอุปกรณ์ Arduino, เครื่องมือช่าง, raspberry pi, สอน ROS fxprime

View GitHub Profile
#include <Arduino_GFX_Library.h> // By Moon On Our Nation
/* Use V1.3.1
* (https://github.com/moononournation/Arduino_GFX) Can be installed via the library manager of the Arduino IDE
*/
#include <XPT2046_Touchscreen.h> // By Paul Stoffregen
/* Use V1.4.0
* (https://github.com/PaulStoffregen/XPT2046_Touchscreen) Can be installed via the library manager of the Arduino IDE
*/
#include <SPI.h>
@fxprime
fxprime / pht_rs485_basic.ino
Created June 17, 2026 04:47
pht sensor rs485 with esp32 + max485
/* ------------------ PH/TEMP Reading code by ModuleMore.com ----------------- */
/* ------------------------------- วิธีการต่อ ------------------------------- */
/**
* @file main.cpp
* @author ModuleMore.com (paheyisoicus@gmail.com)
* @brief รับค่าจาก PH/TEMP sensor เวอร์ชั่น RS485 โดยใช้ RS485 to TTL (รุ่นมี tx rx และ gnd ของ rs485)
* สื่อสารผ่าน Serial1 (ที่เรา define ขาไว้เป็น RX = 13, TX = 15) ด้วย Library ModbusMaster
*
#pragma once
// html_page.h
// Place this file in the SAME folder as ESP32_PCA9685_ServoWS.ino
// Arduino's prototype-generator only scans .ino files, so JavaScript
// "function" keywords inside this string won't cause compile errors.
const char INDEX_HTML[] PROGMEM = R"HTMLEOF(
<!DOCTYPE html>
<html lang="en">
<head>
/*
* ESP32 + PCA9685 Servo Controller with WebSocket GUI
* =====================================================
* Controls servos 0-3 on PCA9685 via a browser-based dashboard.
*
* FOLDER STRUCTURE (both files must be in the same sketch folder):
* ESP32_PCA9685_ServoWS/
* ESP32_PCA9685_ServoWS.ino ← this file
* html_page.h ← HTML dashboard (included below)
*
#!/usr/bin/env python3
"""
RS-LDO-N01-1 Fluorescence Dissolved Oxygen Sensor
Raspberry Pi — USB to RS485 reader
Default: address 0x01, baud 4800
"""
import serial
import struct
import time
@fxprime
fxprime / DO_sensor_auto_scanner.ino
Created April 21, 2026 17:25
RS-LDO-N01-1 — Auto Scanner
/* -------------------------------------------------------------------------- */
/* RS-LDO-N01-1 — Auto Scanner (address + baud rate) */
/* -------------------------------------------------------------------------- */
#include <Arduino.h>
#include <SoftwareSerial.h>
#include <ModbusMaster.h>
EspSoftwareSerial::UART mySerial;
/**
PS2 Wireless Controller Data Streaming
Modified for web visualization with structured data format
Messages prefixed with:
- DATA: Controller state data
- LOG: User information
- ERROR: Error messages
- WARN: Warning messages
**/
/*
ESP8266 Board Tester (I/O + WiFi)
- Arduino core for ESP8266
- Features:
* Serial menu for quick tests
* Simple web UI to view digital inputs & ADC, toggle outputs
* WiFi scan, connect (via Serial), start SoftAP
Pin notes:
- Be careful with GPIO0, GPIO2, GPIO15: they affect boot. Use them carefully.
- A0 is ADC (analogRead)
#include <Arduino.h>
#include "HX711.h"
#include <Preferences.h>
// HX711 circuit wiring
#define LOADCELL_DOUT_PIN 27
#define LOADCELL_SCK_PIN 26
HX711 scale;
Preferences preferences;
@fxprime
fxprime / TCS3200_esp32.ino
Created July 1, 2025 17:03
ตัวอย่างโค้ดสำหรับการใช้งาน TCS3200 Sensor บน ESP32 พร้อมการปรับเทียบเซ็นเซอร์เพื่อให้สามารถอ่านค่าสีได้อย่างแม่นยำ
/**
* ตัวอย่างโค้ดสำหรับการใช้งาน TCS3200 Sensor บน ESP32
* พร้อมการปรับเทียบเซ็นเซอร์เพื่อให้สามารถอ่านค่าสีได้อย่างแม่นยำ
*
* วิธีการต่อสาย:
* | ESP32 Pin | TCS3200 Pin |
* |------------|-------------|
* | 3.3v | Vcc |
* | GND | GND |
* | 3.3v | LED |