Skip to content

Instantly share code, notes, and snippets.

View fxprime's full-sized avatar

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

View GitHub Profile
@fxprime
fxprime / ESP32_MAX485_DO_SENSOR.ino
Created March 30, 2025 05:26
ModuleMore RS-LDO-N01-1 (Modbus) Example code
/* -------------------------------------------------------------------------- */
/* ModuleMore RS-LDO-N01-1 (Modbus) Example code */
/* -------------------------------------------------------------------------- */
/* ------------------------------- วิธีการต่อ ------------------------------- */
/**
| ESP32 | 12V Adapter | MAX485 | DO RS485 |
|-------|-------------|--------|----------|
| GND | GND | GND | Black |
| 3.3V | | VCC | |
#include <Arduino.h>
/* Get all possible data from MPU6050
* Accelerometer values are given as multiple of the gravity [1g = 9.81 m/s²]
* Gyro values are given in deg/s
* Angles are given in degrees
* Note that X and Y are tilt angles and not pitch/roll.
*
* License: MIT
*/
#include <Arduino.h>
#include <SoftwareSerial.h>
#include <TinyGPSPlus.h>
EspSoftwareSerial::UART gpsSerial;
TinyGPSPlus gps;
static void smartDelay(unsigned long ms);
#include <Arduino.h>
#include <SoftwareSerial.h>
#include <TinyGPSPlus.h>
EspSoftwareSerial::UART gpsSerial;
TinyGPSPlus gps;
void displayInfo();
#include <Arduino.h>
#include <SoftwareSerial.h>
/*
lib_deps =
plerup/EspSoftwareSerial @ ^8.2.0
tinyu-zhao/TinyGPSPlus-ESP32 @ ^0.0.2
*/
EspSoftwareSerial::UART gpsSerial;
#include <Arduino.h>
#include <QMC5883LCompass.h>
/*
lib: mprograms/QMC5883LCompass @ ^1.2.3
*/
@fxprime
fxprime / pms3003_esp32_ntp.ino
Created February 15, 2025 03:22
Using ESP32 to measure PM2.5 using PMS3003
#include <Arduino.h>
#include <Wire.h>
#include <LiquidCrystal_PCF8574.h>
#include <SoftwareSerial.h>
#include <WiFi.h>
#include <NTPClient.h> // Library : NTPClient by Fabrice Weinberg
#include <WiFiUdp.h>
#include <TimeLib.h> // Library : Time by Michael Margolis
#define WIFI_SSID "<SSID>" // change WIFI SSID
function doGet(e) {
var timestamp = e.parameter.timestamp;
var uid = e.parameter.uid;
var status = e.parameter.status;
var GSCRIPT_ID = "<ENTER GSCRIPT_ID>";
var urls="https://docs.google.com/spreadsheets/d/"+GSCRIPT_ID+"/edit?gid=0#gid=0";
var ss=SpreadsheetApp.openByUrl(urls);
var ws=ss.getSheetByName("Sheet1");
ws.appendRow([timestamp, uid, status]);
return "Done"
/**
* ModuleMore Co., Ltd.
* @date 2024-12-03
*
* Wiring
* | MAX31855 | ESP32 |
* |----------|-------|
* | Vin | 3.3V |
* | Gnd | Gnd |
* | SCK | 26 |
/*
* DRV8871 Motor Control with Arduino UNO
*
* Wiring:
* Arduino UNO DRV8871
* -----------------------------------
* D5 IN1
* D6 IN2
* GND GND
* VIN VM (Motor Power Supply)