This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Connect RFID Unit2 to Port.A | |
#include <M5Unified.h> | |
#include "MFRC522_I2C.h" // https://github.com/m5stack/M5Stack/tree/master/examples/Unit/RFID_RC522 | |
static MFRC522 mfrc522_(0x28); | |
static String data = ""; | |
void setup() { | |
M5.begin(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <M5StickC.h> | |
float _x, _y, _z; | |
void setup() { | |
M5.begin(); | |
M5.Imu.Init(); | |
M5.IMU.getAccelData(&_x, &_y, &_z); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ESP-NOW broadcast sender | |
#include <Arduino.h> | |
#include <esp_now.h> | |
#include <WiFi.h> | |
// タクトスイッチのピン | |
constexpr uint8_t SW_PIN = G39; | |
constexpr uint8_t CHANNEL = 1; | |
constexpr uint8_t BROADCAST[] = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Arduino.h> | |
#include <Wire.h> | |
float read_distance() { | |
Wire.beginTransmission(0x57); | |
Wire.write(0x01); | |
Wire.endTransmission(); | |
::delay(50); | |
if (Wire.requestFrom(0x57, 3) != 3) { | |
return -1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <M5Unified.h> | |
#include <BleMouse.h> // https://github.com/T-vK/ESP32-BLE-Mouse | |
BleMouse mouse; | |
void move(bool left) { | |
const uint8_t dx = 100 * (left ? -1 : 1); | |
for (auto i = 0; i < 10; ++i) { | |
mouse.move(dx, 0); | |
::delay(1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SG90 brown -> GND | |
// red -> 5v | |
// orange -> G26 | |
#include <M5Atom.h> | |
void setDegree(double deg) { | |
Serial.printf("Deg: %f\r\n", deg); | |
auto v = deg * (2.4 - 0.5) / 180.0 + 0.5; | |
v /= 20.0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define LGFX_USE_V1 | |
#include <SPIFFS.h> | |
#include <LovyanGFX.hpp> | |
constexpr static char PNG_FILE[] = "/picture.png"; | |
class LGFX : public lgfx::LGFX_Device { | |
lgfx::Panel_GC9A01 _panel_instance; | |
lgfx::Bus_SPI _bus_instance; | |
lgfx::Light_PWM _light_instance; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Arduino.h> | |
#include <SparkFun_SCD30_Arduino_Library.h> | |
SCD30 airSensor; | |
void setup() { | |
Serial.begin(115200); | |
Wire.begin(1, 0); | |
if (airSensor.begin() == false) { | |
ESP_LOGE("", "Failed to begin SCD30."); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Arduino.h> | |
#include <IRsend.h> | |
static IRsend irsend(26); | |
static constexpr int input_pin = 13; | |
void setup() { | |
irsend.begin(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Arduino.h> | |
#include <IRsend.h> | |
volatile SemaphoreHandle_t xMutex = NULL; | |
int targetVolume = 0; | |
int currentVolume = targetVolume; | |
constexpr int input_pin = 13; | |
void task_main(void* arg) { |