Skip to content

Instantly share code, notes, and snippets.

@mongonta0716
mongonta0716 / lv_conf.h
Last active May 27, 2025 12:01
Tab5でLVGLを使うときのplatformio.ini
#define LV_COLOR_DEPTH 16
#define LV_COLOR_16_SWAP 1
#define LV_MEM_CUSTOM 1
#define LV_TICK_CUSTOM 1
@mongonta0716
mongonta0716 / wpa_supplicant.conf
Created May 7, 2025 11:10
ModuleLLMで、アクセスポイントを複数設定する/etc/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
update_config=1
pmf=1
sae_pwe=2
network={
ssid="YOUR_SSID_01"
psk="YOUR_PASS_01"
priority=5
id_str="home"
@mongonta0716
mongonta0716 / gemini_arecord.py
Last active May 1, 2025 09:35
M5Stack ModuleLLMでGeminiAPIを使うスクリプト
import subprocess
import speech_recognition as sr
from gtts import gTTS
import os
import google.generativeai as genai
# ==== 設定 ====
GEMINI_API_KEY = "YOUR_API_KEY" # ← あなたのAPIキーに変更
genai.configure(api_key=GEMINI_API_KEY)
model = genai.GenerativeModel(model_name="models/gemini-2.0-flash")
error[E0433]: failed to resolve: could not find `UsbEndpointType` in `web_sys`
--> /Users/mongonta555/.cargo/registry/src/index.crates.io-6f17d22bba15001f/webusb-web-0.3.0/src/lib.rs:302:22
|
302 | web_sys::UsbEndpointType::Bulk => Self::Bulk,
| ^^^^^^^^^^^^^^^ could not find `UsbEndpointType` in `web_sys`
error[E0433]: failed to resolve: could not find `UsbEndpointType` in `web_sys`
--> /Users/mongonta555/.cargo/registry/src/index.crates.io-6f17d22bba15001f/webusb-web-0.3.0/src/lib.rs:303:22
|
303 | web_sys::UsbEndpointType::Interrupt => Self::Interrupt,
@mongonta0716
mongonta0716 / SC_Config.yaml
Created February 15, 2025 14:27
bluetoothsimpleのコンフィグ
servo:
pin:
# ServoPin
# Core1 PortA X:22,Y:21 PortC X:16,Y:17
# Core2 PortA X:33,Y:32 PortC X:13,Y:14
# Stack-chanPCB Core1 X:5,Y:2 Core2 X:19,Y27
# When using SCS0009, x:RX, y:TX (not used).(StackchanRT Version:Core1 x16,y17, Core2: x13,y14)
x: 33
y: 32
offset:
@mongonta0716
mongonta0716 / builderror.txt
Created February 13, 2025 13:27
esp32-targz build error
.pio/libdeps/m5stack-fire/ESP32-targz/src/uzlib/genlz77.c:114:30: error: expected declaration specifiers or '...' before '[' token
uint32_t uzlib_checksum_none([[maybe_unused]]const void *data, [[maybe_unused]]unsigned int length, uint32_t prev_sum)
^
.pio/libdeps/m5stack-fire/ESP32-targz/src/uzlib/genlz77.c:114:64: error: expected declaration specifiers or '...' before '[' token
uint32_t uzlib_checksum_none([[maybe_unused]]const void *data, [[maybe_unused]]unsigned int length, uint32_t prev_sum)
^
.pio/libdeps/m5stack-fire/ESP32-targz/src/uzlib/genlz77.c: In function 'uzlib_deflate_init_stream':
.pio/libdeps/m5stack-fire/ESP32-targz/src/uzlib/genlz77.c:141:28: error: 'uzlib_checksum_none' undeclared (first use in this function)
ctx->checksum_cb = uzlib_checksum_none;
^~~~~~~~~~~~~~~~~~~
@mongonta0716
mongonta0716 / led.sh
Last active January 31, 2025 12:09
M5Stack ModuleLLMの/etc/rc.localでWiFiの接続を追加して、ステータスをLEDで分かるようにしたrc.local(追加部分のみ)
#!/bin/bash
# 下記のファイルを作成してください。(作成後、chmod +x /usr/local/m5stack/led.shを忘れずに)
# /usr/local/m5stack/led,sh
# 引数の数をチェック
if [ $# -ne 3 ] ; then
echo "Usage: $0 <brightness r> <brightneee g> <brigntness b>"
exit 1
fi
@mongonta0716
mongonta0716 / backup.sh
Last active January 29, 2025 14:39
M5Stack ModuleLLMの設定ファイルをバックアップとリストアするスクリプト
#!/bin/bash
# 設定ファイルをバックアップする。
# microSDカードのマウント先を指定
cd /mnt/mmcblk1p1
mkdir -p backup
cd backup
# 固定IP用の設定ファイル
cp --parents /etc/network/interfaces .
@mongonta0716
mongonta0716 / main.cpp
Last active April 2, 2025 16:14
M5Stack ModuleLLMで日本語をPC(シリアル通信)から入力し、回答をAquesTalkESP32で読み上げるサンプル。(main.cppのコメントを参照してください。)
/*
* SPDX-FileCopyrightText: 2024 M5Stack Technology CO LTD
* SPDX-License-Identifier: MIT
* M5Stack LLM Module で日本語対話。Serial MonitorでBoth BL&CRを設定するとよいです。
* ksasaoさんのバージョンをAquesTalkで喋るようにしたバージョンです。(https://gist.github.com/ksasao/37425d3463013221e7fd0f9ae5ab1c62)
*
* --- セットアップ ---
* 1.プロジェクトにlibフォルダを作成して、そこにAquesTalkESP32のライブラリを解凍してください。(https://www.a-quest.com/download.html#a-etc)
* 2. VSCode+PlatformIOで、srcフォルダにAquesTalkのExampleにある(AquesTalkTTS_M5.cppとAquesTalkTTS.h)をコピーする必要があります。
* 3.SDカード上に"/aq_dic/aqdic_m.bin"が必要です。
#include <Arduino.h>
#include <M5Dial.h>
#include <Avatar.h>
#include "formatString.hpp"
using namespace m5avatar;
Avatar avatar;
void setup() {