Skip to content

Instantly share code, notes, and snippets.

@mongonta0716
mongonta0716 / takaobase_example.cpp
Created April 17, 2024 23:49
M5Stack Core2, CoreS3でStackchan-Takao_Baseを利用する際のコード例
// Stack-chan_Takao_Baseを使用する場合、のコード例
// ※ この設定を行うと、M5Stack本体のUSB-Cに接続してもバッテリーは充電されなくなります。
// (1)初期設定で設定するやり方
auto cfg = M5.config();
cfg.output_power = false; // Groveポートの5VをINに設定します。この設定で背面のUSB-C端子に接続するとM5Stackの電源とバッテリーの充電ができます。
M5.begin(cfg); // 設定を有効にします。
// (2)途中でモードを変える場合
@mongonta0716
mongonta0716 / main.cpp
Last active April 6, 2024 11:08
M5StampS3でHUB75のLEDマトリクスを使うサンプル。
// Example sketch which shows how to display some patterns
// on a 64x32 LED matrix
// Copyright(c) 2024 Takao Akaki
#include <M5Unified.h>
#include <ESP32-HUB75-MatrixPanel-I2S-DMA.h>
// Change these to whatever suits
#define R1_PIN 1
#define G1_PIN 2
@mongonta0716
mongonta0716 / boards_m5stack-nanoc6.json
Last active May 3, 2024 11:06
M5Stack M5NanoC6でRGBLEDを光らせる。(VSCode+Platformio) ※ jsonファイルはboards/m5stack-nanoc6.jsonに作成する。
{
"build": {
"core": "esp32",
"f_cpu": "160000000L",
"f_flash": "80000000L",
"flash_mode": "qio",
"mcu": "esp32c6",
"variant": "esp32c6"
},
"connectivity": [
@mongonta0716
mongonta0716 / main.cpp
Last active January 24, 2024 08:53
M5Unifiedで外部ディスプレイ(SPI接続の液晶)を使う場合のサンプル(例、GC9107) https://ssci.to/9438
/*
M5Unified(M5GFX)でSPI接続の外部LCD(外部液晶)を使用するサンプル。
M5StampS3に下記のように接続しています。0.85インチ LCDディスプレイモジュール(128x128、SPI接続)
M5StampS3 --- LCD
3V3 - VCC
GND - GND
1 - DIN(MOSI)
2 - CLK(SCLK)
3 - CS
4 - DC
@mongonta0716
mongonta0716 / platformio.ini
Created December 16, 2023 05:42
M5StickCPlus2 マイクテスト
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:m5stick-c]
@mongonta0716
mongonta0716 / main.cpp
Last active December 15, 2023 08:44
M5StickCPlus2 HelloWorld
#include <Arduino.h>
#include <M5Unified.h>
void setup() {
M5.begin();
M5.Display.setFont(&fonts::efontJA_16_b);
M5.Display.setTextColor(TFT_RED);
M5.Display.println("Hello, World!");
M5.Display.println("はろーわーるど");
@mongonta0716
mongonta0716 / main.cpp
Created December 8, 2023 09:51
M5Dial + TONE&NOTEの自作キーボード
#include <M5Dial.h>
#include "keyconvination.hpp"
#include "Wire.h"
#include "USB.h"
#include "USBHIDMouse.h"
USBHIDMouse Mouse;
@mongonta0716
mongonta0716 / platformio.ini
Last active November 25, 2023 13:30
ImageAvatarLiteのplatformio.ini
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
@mongonta0716
mongonta0716 / I2Cmaster.ino
Created October 23, 2023 14:40
M5Dial同士でI2C通信するサンプル
#include <Arduino.h>
#include <M5Dial.h>
#include "Wire.h"
#define I2C_DEV_ADDR 0x55
uint32_t i = 0;
void setup() {
@mongonta0716
mongonta0716 / gist:1b4ffa2ea43671bcae156e3a3f616b0e
Last active October 7, 2023 09:07
M5StackにGLASS2 Unitを接続して文字をスクロールするサンプル(OLEDUnitやLCDUnitでもL4, L45を変更すると利用できます。)
// reference
// https://github.com/lovyan03/inside_magimajopures/tree/main/640x48_LCD_ESP32_TextScroll
#include <M5UnitGLASS2.h>
#include <M5Unified.h>
M5GFX gfx;
M5Canvas canvas;
int glass2index = 0;