Skip to content

Instantly share code, notes, and snippets.

@ksasao
ksasao / PressureMonitor.ino
Last active May 4, 2025 06:09
8pin RISC-V マイコン CH32V003J4M6 で気圧変化を可視化。https://x.com/ksasao/status/1918255371950670254
// 8pin RISC-V マイコン CH32V003J4M6 で気圧変化を可視化します
// 気圧センサの生データを直接参照し温度補正等をしていないことに注意してください
// https://x.com/ksasao/status/1918255371950670254
//
// ■ 開発環境
// Arduino IDE 2.3.6
// Boards Manager: CH32 MCU EVT Boards 1.0.4
// https://github.com/openwch/board_manager_files/raw/main/package_ch32v_index.json
// Board: CH32V00x
// ■ パーツ
@ksasao
ksasao / NeoPixel.ino
Last active May 1, 2025 01:18
8pin RISC-V マイコン CH32V003J4M6 で NeoPixel Lチカ https://x.com/ksasao/status/1917595665515045326
// 8pin RISC-V マイコン CH32V003J4M6 で NeoPixel Lチカ
// https://x.com/ksasao/status/1917595665515045326
// ■ パーツ
// CH32V003J4M6 https://akizukidenshi.com/catalog/g/g118062/
// マイコン内蔵RGBLEDモジュール https://akizukidenshi.com/catalog/g/g108414/
//
// コードはほぼ下記を参照しています
// amanoya3: ArduinoでRISC-VマイコンCH32V003にNeoPixelのLEDをつないでみた
// https://ameblo.jp/pta55/entry-12813320408.html
@ksasao
ksasao / sunset.h
Last active March 26, 2025 15:25
現在地の日没時刻/日の出時刻を表示します https://x.com/ksasao/status/1898305387969012007
#ifndef SUNSET_H_
#define SUNSET_H_
#include<math.h>
// 計算式は下記のWebサイトを参考に実装しています
// 日出日没計算、やってみよう
// https://hhsprings.pinoko.jp/site-hhs/2015/02/%e6%97%a5%e5%87%ba%e6%97%a5%e6%b2%a1%e8%a8%88%e7%ae%97%e3%80%81%e3%82%84%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%88%e3%81%86/
typedef struct _DateTime {
int year;
@ksasao
ksasao / makeicon.py
Last active March 2, 2025 06:25
シンプルな日本地図上にマーカーをプロットします https://x.com/ksasao/status/1896076372617150879
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature as cfeature
import pandas as pd
from PIL import Image
import numpy as np
import os
# CSVファイルを読み込む
# https://github.com/ksasao/ekimemo/blob/main/src/20250304/data.csv をローカルに保存してください
@ksasao
ksasao / ScentGPSLogger.ino
Last active February 11, 2025 14:16
M5Atom GPS と ENV Pro で、緯度経度に紐づいた匂いのログを記録します。 https://x.com/ksasao/status/1887864442442096790
// Scent+GPS Logger for M5Atom Atomic GPS Kit
// Library version M5Atom 0.1.3
// Board version M5Stack 2.1.3
#include "bme68xLibrary.h"
#include "M5Atom.h"
#include <sys/time.h>
#include <SPI.h>
#include "FS.h"
#include <SD.h>
#include <TinyGPS++.h>
@ksasao
ksasao / inputText.ino
Last active March 26, 2025 11:09
M5Cardputerで日本語表示。このコードには漢字変換機能はありません。https://x.com/ksasao/status/1884198721749213610
/**
* @file inputText.ino
* @author SeanKwok ([email protected])
* @brief M5Cardputer input text test
* @version 0.1
* @date 2023-10-13
*
*
* @Hardwares: M5Cardputer
* @Platform Version: Arduino M5Stack Board Manager v2.0.7
@ksasao
ksasao / Program.cs
Created January 25, 2025 06:54
Snipping Tool のインストールパスを取得する(Microsoft.ScreenSketch という名前でインストールされている)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FindSnippingToolPath
{
using System;
using System.Diagnostics;
@ksasao
ksasao / MainPage.xaml.cs
Created January 14, 2025 17:15
UWPで日本語OCR。XAMLは適当に作ってください。https://x.com/ksasao/status/1879207301850259523
using System;
using Windows.Graphics.Imaging;
using Windows.Media.Ocr;
using Windows.Storage.Pickers;
using Windows.Storage.Streams;
using Windows.Storage;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using System.Text;
@ksasao
ksasao / getstations.py
Last active January 13, 2025 04:30
駅データ https://github.com/Seo-4d696b75/station_database/blob/main/README.md の station.json と路線のpolylineデータ(11332.jsonなど)を利用して、指定した路線に乗車したときに駅メモでチェックイン可能な駅一覧を取得します。 https://x.com/ksasao/status/1877353964657590593
import json
import argparse
from shapely.geometry import Point, Polygon
from shapely.strtree import STRtree
def read_json(file_path):
with open(file_path, 'r', encoding='utf-8') as file:
data = json.load(file)
return data
@ksasao
ksasao / AzureMQTT.ino
Created December 19, 2024 12:54
Azure IoT Hub に対して M5Atom で直接MQTT。SAS Token やルート証明書もハードコーディングしていますが一応通信はできます。
#include "M5Atom.h"
#include <WiFi.h>
#include <PubSubClient.h>
#include <WiFiClientSecure.h>
#include "bme68xLibrary.h"
#include <math.h>
// home
const char* ssid = "your-ssid";
const char* password = "your-password";