Skip to content

Instantly share code, notes, and snippets.

View maxpromer's full-sized avatar

Max maxpromer

View GitHub Profile
/* ----------------------------------------------------------------------
"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
#include "Arduino.h"
#include "WiFi.h"
#include "Audio.h"
// ─── กำหนดขา I2S ───────────────────────────────────────
#define I2S_BCK_PIN 26
#define I2S_WS_PIN 25
#define I2S_DATA_PIN 22
// ─── ข้อมูล Wi-Fi ────────────────────────────────────────
#define DE_RE_PIN 4
#define MODE_SEND HIGH
#define MODE_RECV LOW
void setup() {
pinMode(DE_RE_PIN, OUTPUT);
digitalWrite(DE_RE_PIN, MODE_RECV);
Serial.begin(115200);
Serial2.begin(9600, SERIAL_8N1, 16, 17); // Rx, Tx
@maxpromer
maxpromer / cam_ai.py
Created November 16, 2025 17:22
Raspberry Pi Camera Module 3 image classification with MobileNet
from picamera2 import Picamera2
import cv2
import numpy as np
# Load the TensorFlow model (frozen graph + pbtxt)
model = cv2.dnn.readNetFromTensorflow(
"frozen_inference_graph.pb",
"ssd_mobilenet_v1_coco_2017_11_17.pbtxt"
)
@maxpromer
maxpromer / cam_opencv_resize_and_draw.py
Created November 16, 2025 17:21
Raspberry Pi Camera Module 3 image editor by OpenCV
from picamera2 import Picamera2
import cv2
picam2 = Picamera2()
# Set up Auto Focus
config = picam2.create_preview_configuration()
picam2.configure(config)
picam2.start()
@maxpromer
maxpromer / cam_autofocus_test.py
Created November 16, 2025 17:19
Raspberry Pi Camera Module 3 autofocus settings with Python
from picamera2 import Picamera2
import cv2
picam2 = Picamera2()
# Set up Auto Focus
config = picam2.create_preview_configuration()
picam2.configure(config)
picam2.start()
@maxpromer
maxpromer / cam_test.py
Created November 16, 2025 17:18
Raspberry Pi Camera Module 3 image preview with Python
from picamera2 import Picamera2
import cv2
# Initialize the camera
picam2 = Picamera2()
picam2.start()
try:
while True:
# Capture frame from the camera