Skip to content

Instantly share code, notes, and snippets.

@ksasao
ksasao / EnvIVTest.ino
Last active March 3, 2024 02:24
I tried using ENV IV with M5UnitENV v1.0.0 library, however it did not read temperature and humidity properly in my environment, so I modified it to work.
// https://github.com/m5stack/M5Unit-ENV
#include "M5Atom.h"
#include "M5UnitENV.h"
SHT4X sht4;
BMP280 bmp;
// I2C Address for M5Atom Grove Connector
#define SDA_PIN 26
#define SCL_PIN 32
@ksasao
ksasao / SEFR.cpp
Created October 4, 2023 13:40
SEFR multi-class classifier algorithm implementation for M5Atom
/*
This code is derived from the SEFR multi-class classifier algorithm developed by Alan Wang.
The original code can be found at https://github.com/alankrantas/sefr_multiclass_classifier.
The code is licensed under the MIT License.
https://opensource.org/licenses/mit-license.php
*/
#include "SEFR.h"
uint8_t m_features;
@ksasao
ksasao / eki_map.html
Last active September 29, 2023 16:09
列挙した駅名を地図上にプロットします。stations.csv は別途用意してください。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>駅一覧</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" />
<style>
body {
margin: 0;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Fukashigi
{
internal class Program
{
@ksasao
ksasao / Program.cs
Last active May 25, 2023 03:56
byte[] のデータをグレースケールビットマップ画像として保存。widthが4の倍数ではないケースを考慮。
// https://symfoware.blog.fc2.com/blog-entry-2195.html
// のコードで Width が 4の倍数ではない場合も考慮
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Drawing.Imaging;
@ksasao
ksasao / BTRTK.ino
Last active July 15, 2023 15:48
M5StickC と u-blox ZED-F9P でRTK測位をするサンプル。M5StickCとZED-F9Pモジュールとの接続はI2C、RTCM3はAndroid スマホからの Bluetooth Serial 経由で受信する実装です。https://twitter.com/ksasao/status/1655098208903888901
#include <M5GFX.h>
#include <M5StickCPlus.h>
#include "BluetoothSerial.h"
#include <TinyGPS++.h>
#include <SparkFun_u-blox_GNSS_Arduino_Library.h>
SFE_UBLOX_GNSS myGNSS;
// Location of Destination
double destLat = 35.5000000;
double destLon = 139.6000000;
@ksasao
ksasao / hello.txt
Created February 12, 2023 15:28
Bingから見えるかテスト
Hello
@ksasao
ksasao / index.html
Last active December 29, 2022 06:10
Alternative to labeled geo intent for iOS (also works for Android) . Sample URL -> http://gist.githack.com/ksasao/bc5fc05d0676f3ec07cf8666e8236c8f/raw/index.html?p=@35.6813077,139.7670152,17z&t=Tokyo%20Sta.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Map Viewer</title>
<link rel="stylesheet" href="https://d19vzq90twjlae.cloudfront.net/leaflet-0.7.3/leaflet.css" />
<!-- reference to Leaflet JavaScript -->
<script src="https://d19vzq90twjlae.cloudfront.net/leaflet-0.7.3/leaflet.js"></script>
@ksasao
ksasao / A_OMMF_Weight.ino
Created December 3, 2022 21:42
M5Stack用はかりキット(重さユニット付き)https://www.switch-science.com/products/8014 を利用した重量取得のコードです。#OMMF2022 で利用したものです。メディアンフィルタ(中央値フィルタ)を使って、このセンサ特有のスパイク状(とびとびの値)のノイズを除去しています。
#include <M5Atom.h>
#include "BrownieClient.h"
#define PIN_DOUT 32
#define PIN_SLK 26
#define MEDIAN_FILTER_SIZE 10
static char ssid[64] = "your-ssid";
static char pass[64] = "your-password";
static char mqtt[64] = "192.168.xx.xx";