Skip to content

Instantly share code, notes, and snippets.

@hollyhockberry
hollyhockberry / main.cpp
Last active May 22, 2023 00:14
Sample: Using Whisper API with M5 CoreS3
// Copyright (c) 2023 Inaba (@hollyhockberry)
// This software is released under the MIT License.
// http://opensource.org/licenses/mit-license.php
#include <SD.h>
#include <M5Unified.h>
#include <WiFi.h>
#include <HTTPClient.h>
#include <ArduinoJson.h>
#include <gob_unifiedButton.hpp>
@ksasao
ksasao / atomcam2_rtspwriter.py
Last active September 1, 2023 12:51
ATOM Cam 2 の映像を RTSP で受信して1分毎にファイル名を変えて動画で保存する Python コード。詳細→ https://twitter.com/ksasao/status/1593834857536585729
# RTSPを受信して .mp4 にエンコード
# ATOM Cam 2 は 20fps が標準 (赤外カメラモードでは15fpsとなるが下記コードは未対応)
import cv2
import datetime
import os
# 日付をファイル名にする
def get_filename():
now = datetime.datetime.now()
filename = './mp4/' + now.strftime('%Y%m%d_%H%M') + '.mp4'
@mongonta0716
mongonta0716 / main.cpp
Created April 6, 2022 06:44
UARTから受信したデータをESP-NOWで複数のM5Stackに流す(要Arduino-esp32 2.0.3RC1)
// UARTで受信したデータをESP-NOWで送信するサンプル
// 受信はESP-NOW MONITORが使えます。https://gist.github.com/mongonta0716/6a749f3f5a3e119d47a13b5c5c9c69db
#include <Arduino.h>
#include <M5Unified.h>
#include <esp_now.h>
#include <WiFi.h>
#include <esp_wifi.h>
esp_now_peer_info_t esp_ap;
@mongonta0716
mongonta0716 / M5Core2_PDMUnit_and_Speaker
Created February 4, 2022 15:21
M5Core2のPort.AにPDMUnitを繋いで、スピーカーとマイクを同時に使えるようにするサンプル。
// The source of the following link has been modified
// https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/PDM
#include <M5Core2.h>
#include <driver/i2s.h>
#include "fft.h"
#define PIN_CLK 33
#define PIN_DATA 32
@imliubo
imliubo / M5Core2-display-image.py
Last active March 30, 2021 15:46
M5Core2 display images through HTTP request
import urequests
import time
import wifiCfg
from m5stack import lv, rtc
wifiCfg.auto_connect()
ticks_ms = 0
old_tick = 0
@mongonta0716
mongonta0716 / main.cpp
Last active July 5, 2022 00:25
ESP-NOW Monitor ESP-NOWで受け取ったデータを表示し続けるアプリ
#include <Arduino.h>
#ifdef ARDUINO_M5STACK_Core2
#include <M5Core2.h>
#elif defined(ARDUINO_M5STACK_FIRE) || defined(ARDUINO_M5Stack_Core_ESP32)
#include <M5Stack.h>
#endif
#define LGFX_AUTODETECT
#include <LovyanGFX.hpp>
#include <esp_now.h>
#include <WiFi.h>
@3110
3110 / Core2_RTC_with_NTP.ino
Last active June 3, 2021 15:49
NTPを使ってM5Stack Core2のRTCを設定する
#include <M5Core2.h>
#include <WiFi.h>
const char* SSID = "SSID";
const char* PASSWORD = "SSID Password";
const char* NTP_SERVER = "ntp.jst.mfeed.ad.jp";
const char* TZ = "JST-9";
const uint8_t FONT_NUMBER = 2; // 16px ASCII Font
const uint8_t FONT_SIZE = 16;
@ciniml
ciniml / grove_left_uart.ino
Last active August 16, 2022 18:55
Wio Terminal Grove UART
#include <wiring_private.h>
static Uart Serial3(&sercom3, PIN_WIRE_SCL, PIN_WIRE_SDA, SERCOM_RX_PAD_1, UART_TX_PAD_0);
void setup() {
Serial.begin(115200);
while(!Serial);
Serial3.begin(115200);
pinPeripheral(PIN_WIRE_SCL, PIO_SERCOM_ALT);
@ksasao
ksasao / boot.py
Last active April 2, 2022 05:09
M5StickV で UART 文字列受信サンプル。uart.any() で受信バッファの状態を確認して readline() で読むのが簡単。https://twitter.com/ksasao/status/1239058196334923776
import lcd
import image
import time
import uos
lcd.init()
lcd.rotation(2) #Rotate the lcd 180deg
from Maix import I2S, GPIO
from Maix import GPIO
@takeru
takeru / axp192.py
Last active September 12, 2019 12:38
M5StickVの電源管理
# M5StickVの電源管理方法
# https://github.com/sipeed/MaixPy/blob/master/components/boards/m5stick/src/m5stick.c
# https://github.com/sipeed/MaixPy/blob/master/projects/maixpy_m5stickv/builtin_py/pmu.py
# https://pdf1.alldatasheet.com/datasheet-pdf/view/757469/ETC2/AXP192.html
# 参考: M5StickC https://github.com/m5stack/M5StickC/blob/master/src/AXP192.cpp
import lcd
import pmu