Skip to content

Instantly share code, notes, and snippets.

View maxpromer's full-sized avatar

Max maxpromer

View GitHub Profile
/*
Go to thingspeak.com and create an account if you don't have one already.
After logging in, click on the "New Channel" button to create a new channel for your data. This is where your data will be stored and displayed.
Fill in the Name, Description, and other fields for your channel as desired, then click the "Save Channel" button.
Take note of the "Write API Key" located in the "API keys" tab, this is the key you will use to send data to your channel.
Replace the channelID from tab "Channel Settings" and privateKey with "Read API Keys" from "API Keys" tab.
Replace the host variable with the thingspeak server hostname "api.thingspeak.com"
Upload the sketch to your ESP32 board and make sure that the board is connected to the internet. The ESP32 should now send data to your Thingspeak channel at the intervals specified by the loop function.
Go to the channel view page on thingspeak and check the "Field1" for the new incoming data.
You can use the data visualization and ana
#include <ACAN2517FD.h>
#include <SPI.h>
// Configs Pin
static const int CAN_CONTROLLER_SCK = 18;
static const int CAN_CONTROLLER_MOSI = 23;
static const int CAN_CONTROLLER_MISO = 19;
static const int CAN_CONTROLLER_CS = 5;
static const int CAN_CONTROLLER_INT = 15;
@maxpromer
maxpromer / MCP251863_LoopBack.ino
Created August 20, 2026 16:39
MCP251863 โมดูล CAN FD Controller SPI โค้ด Loop Back ทดสอบเชื่อมต่อ CAN Controller + CAN Transceiver
#include <ACAN2517FD.h>
#include <SPI.h>
// Configs Pin
static const int CAN_CONTROLLER_SCK = 18;
static const int CAN_CONTROLLER_MOSI = 23;
static const int CAN_CONTROLLER_MISO = 19;
static const int CAN_CONTROLLER_CS = 5;
static const int CAN_CONTROLLER_INT = 15;
#include <Arduino.h>
#include <WiFi.h>
#include <WiFiClientSecure.h>
#include <DuinoClaw.h>
// Built-in tools
#include <Tools/GetCurrentTimeTool.h>
#include <Tools/GPIOTool.h>
#include <Tools/WiFiTool.h>
void setup() {
Serial.begin(115200);
Serial2.begin(9600, SERIAL_8N1, 4, -1); // RX pin=4, TX pin=no connect
}
void loop() {
int c = Serial2.read(); // Read data from GM65
if (c >= 0) { // if can be read
Serial.write((char) c); // send it to Serial Monitor
} else {
#include <Arduino.h>
#include <Wire.h>
#include <IOXESP32_4-20mA_Receiver.h>
Receiver4_20 sensor(&Wire, 0x45); // Default 0x45
const int raw_in_0cm = 6485; // Enter Raw value in level 0CM
const int raw_in_20cm = 7521; // Enter Raw value in level 20CM
void setup() {
/* ----------------------------------------------------------------------
"Simple" Protomatter library example sketch (once you get past all
the various pin configurations at the top, and all the comments).
Shows basic use of Adafruit_Protomatter library with different devices.
This example is written for a 64x32 matrix but can be adapted to others.
Once the RGB matrix is initialized, most functions of the Adafruit_GFX
library are available for drawing -- code from other projects that use
LCDs or OLEDs can be easily adapted, or may be insightful for reference.
#include <Adafruit_Protomatter.h>
#include <Wire.h>
#include <ArtronShop_SHT3x.h>
uint8_t rgbPins[] = {42, 41, 40, 39, 38, 37}; // R1, G1, B1, R2, G2, B2
uint8_t addrPins[] = {48, 36, 45, 35}; // A, B, C, D
uint8_t clockPin = 2; // CLK
uint8_t latchPin = 47; // LAT
uint8_t oePin = 14; // OE
#include <Adafruit_Protomatter.h>
#include <WiFi.h>
#include <WiFiMulti.h>
#include "time.h"
uint8_t rgbPins[] = {42, 41, 40, 39, 38, 37}; // R1, G1, B1, R2, G2, B2
uint8_t addrPins[] = {48, 36, 45, 35}; // A, B, C, D
uint8_t clockPin = 2; // CLK
uint8_t latchPin = 47; // LAT
uint8_t oePin = 14; // OE
#include <driver/i2s.h>
#include <math.h>
// ─── กำหนดขา I2S ───────────────────────────────────────
#define I2S_BCK_PIN 26 // Bit Clock
#define I2S_WS_PIN 25 // Word Select (LRCK)
#define I2S_DATA_PIN 22 // Data Out → DIN ของโมดูล
// ─── พารามิเตอร์เสียง ────────────────────────────────────
#define SAMPLE_RATE 44100