Skip to content

Instantly share code, notes, and snippets.

#include <Arduino.h>
#include <vector>
#include <WiFi.h>
#include <Wire.h>
#include "SPI.h"
#include "Adafruit_GFX.h" //for matrix led
#include "Adafruit_LEDBackpack.h"
#define REMOTEXY_MODE__ESP32CORE_WIFI_POINT
#include <RemoteXY.h>
@woodif
woodif / BMP280.ino
Last active June 21, 2022 09:39
ESP32_BMP280
/* This code is to use with Adafruit BMP280 (Metric)
* It measures both temperature and pressure and it displays them on the Serial monitor with the altitude
* It's a modified version of the Adafruit example code
* Refer to www.surtrtech.com or SurtrTech Youtube channel
*/
#include <Wire.h>
#include <Adafruit_BMP280.h>
Adafruit_BMP280 bmp; // I2C Interface
/**
* www.arduinona.com
* ตัวอย่างการเซ็ตค่าเวลา ให้ DS3231
* ใช้คู่กับ Library DS3231 จาก https://github.com/PilleStat/PilleStat/tree/master/arduino%20code/libraries/DS3231
* วิธีการต่อ
* Arduino UNO -> DS3231
* 5V -> VCC
* GND -> GND
* SDA -> A4
* SCL -> A5
@woodif
woodif / PWMmotor.ino
Last active September 23, 2023 11:02
/*
ledcWrite_RGB.ino
Runs through the full 255 color spectrum for an rgb led
Demonstrate ledcWrite functionality for driving leds with PWM on ESP32
This example code is in the public domain.
Some basic modifications were made by vseven, mostly commenting.
*/
// Motor
void setup() {
pinMode(4, INPUT);
pinMode(13, INPUT);
pinMode(21, INPUT);
pinMode(22, INPUT);
pinMode(23, INPUT);
pinMode(25, INPUT);
}
void loop() {
Serial.print(digitalRead(4));
void setup() {
Serial.begin(115200);
}
void loop() {
Serial.print(analogRead(26));
Serial.print(String(","));
Serial.print(analogRead(27));
Serial.print(String(","));
Serial.print(analogRead(32));
Serial.print(String(","));
void setup() {
pinMode(16, OUTPUT);
pinMode(17, OUTPUT);
pinMode(18, OUTPUT);
pinMode(19, OUTPUT);
}
void loop() {
digitalWrite(16, 1);
digitalWrite(17, 0);
digitalWrite(18, 1);
#include <Servo.h>
static const int servoPin = 14; //14,15
Servo servo1;
void setup() {
Serial.begin(115200);
servo1.attach(servoPin);
}
@woodif
woodif / GxEPD_ex.ino
Created October 22, 2021 12:36
test e-paper
#define LILYGO_T5_V24
// GxEPD_MinimumExample by Jean-Marc Zingg
#include <boards.h>
#include <GxEPD.h>
// select the display class to use, only one, copy from GxEPD_Example
#include <GxGDE0213B1/GxGDE0213B1.h> // 2.13" b/w old panel , form GoodDisplay
#include <GxIO/GxIO_SPI/GxIO_SPI.h>
#include <SoftwareSerial.h>
#include "RedMP3.h"
#define MP3_RX 33//RX of Serial MP3 module connect to D7 of Arduino
#define MP3_TX 36//TX to D8, note that D8 can not be used as RX on Mega2560, you should modify this if you donot use Arduino UNO
MP3 mp3(MP3_RX, MP3_TX);
int8_t volume = 0x1a;//0~0x1e (30 adjustable level)
int8_t folderName = 0x01;//folder name must be 01 02 03 04 ...
int8_t fileName = 0x002; // prefix of file name must be 001xxx 002xxx 003xxx 004xxx ...