Skip to content

Instantly share code, notes, and snippets.

View fxprime's full-sized avatar

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

View GitHub Profile
/* -------------------------------------------------------------------------- */
/* ModuleMore AM2306 (Modbus) Example code */
/* -------------------------------------------------------------------------- */
/* ------------------------------- วิธีการต่อ ------------------------------- */
/**
* ESP32 ---> MAX485 ---> AM2306
* 3.3V VCC
* 5V RED
* GND GND BLACK
@fxprime
fxprime / esp32_ublox_m8n.cpp
Last active March 1, 2024 09:30
gps neo8n ublox esp32
gps neo8n ublox esp32
ESP32 + NEO8N with ublox protocal
wiring
ESP32 Ublox Neo M8N
/**
* @brief esp8266 Module4-x test purpose
*
*/
#include <Arduino.h>
#include <ESP8266WiFiMulti.h>
ESP8266WiFiMulti wifiMulti;
#define DEVICE "ESP8266"
/* -------------------------------------------------------------------------- */
/* ModuleMore AM2306 (Modbus) Example code */
/* -------------------------------------------------------------------------- */
/* ------------------------------- วิธีการต่อ ------------------------------- */
/**
* ESP8266 ---> MAX485 ---> AM2306
* 5V 5V RED
* GND GND BLACK
* - RE (ต่อกับDE)
from machine import Pin, Timer
from time import sleep
import time
from neopixel import Neopixel # neopixel lib = https://github.com/blaz-r/pi_pico_neopixel/blob/main/neopixel.py
LED_PIN = 25
USRBUTTON_PIN = 24
NEOPIXEL_PIN = 23
/* ------------------ Relay Reading/Writing code by ModuleMore.com ----------------- */
/* ------------------------------- วิธีการต่อ ------------------------------- */
/**
* @file main.cpp
* @author ModuleMore.com ([email protected])
* @brief รับส่งค่า relay เวอร์ชั่น RS485 โดยใช้ RS485 to TTL (รุ่นมี tx rx และ gnd ของ rs485)
* สื่อสารผ่าน Serial1 (ที่เรา define ขาไว้เป็น RX = 13, TX = 15) ด้วย Library ModbusMaster
*
* Wiring
/* ------------------ Relay Reading/Writing code by ModuleMore.com ----------------- */
/* ------------------------------- วิธีการต่อ ------------------------------- */
/**
* @file main.cpp
* @author ModuleMore.com ([email protected])
* @brief รับส่งค่า relay เวอร์ชั่น RS485 โดยใช้ RS485 to TTL (รุ่นมี tx rx และ gnd ของ rs485)
* สื่อสารผ่าน Serial1 (ที่เรา define ขาไว้เป็น RX = 13, TX = 15) ด้วย Library ModbusMaster
*
* Wiring
/**
Example of Modulemore XKC-Y25-PNP (NO configuration)
Sensor ---- Arduino
(Brown) VCC = 5v
(Yellow) INPUT = digital 5 --> 4.7k ohm --> GND
(Blue) GND = GND
(Black) Not connected.
*/
int XKC_NO_PIN = 5;
void setup() {
@fxprime
fxprime / SHT20_esp32.ino
Last active July 22, 2023 08:55
ตัวอย่างโค้ดอ่านค่า SHT20 ด้วย ESP32 และ RS485 to TTL พร้อมให้ค่า Heat-index
/* -------------------------------------------------------------------------- */
/* ModuleMore SHT20 (Modbus) Example code */
/* -------------------------------------------------------------------------- */
/* ------------------------------- วิธีการต่อ ------------------------------- */
/**
* ESP32 ---> MAX485 ---> XY-MD02
* 3.3V 3.3V
* GND GND -
* 21 RX
@fxprime
fxprime / gy25_serial.ino
Created June 23, 2023 09:38
Example for serial mode of GY-25
/**
www.modulemore.com
Example for serial mode of GY-25
Product link : https://www.modulemore.com/product/1888/เซนเซอร์วัดการเอียง-gy-25-tilt-sensor-module-mpu-6050
Based on : https://forum.arduino.cc/t/run-gy-25-in-arduino-ide-with-kalman-filter/565016
PDF : http://mkpochtoi.ru/GY25_MANUAL_EN.pdf
*/
#include <SoftwareSerial.h>
static const int RXPin = 2, TXPin = 3; // announce your Rx and Tx pins