Skip to content

Instantly share code, notes, and snippets.

View katsuyoshi's full-sized avatar

Katsuyoshi Ito katsuyoshi

  • ITO SOFT DESIGN Inc.
  • Akita, Japan
View GitHub Profile
@katsuyoshi
katsuyoshi / main.cpp
Last active March 7, 2023 15:12
M5AtomS3でソニーテレビの赤外線リモコン信号を送信
#include <Arduino.h>
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <M5Unified.h>
#ifndef USE_USEBSERIAL
#define USBSerial Serial
#endif
static uint16_t kIrLed = 4;
@katsuyoshi
katsuyoshi / main.cpp
Last active March 5, 2023 13:56
M5AtomS3でIR受信データを確認。IRremoteESP8266のサンプルIRrecvDumpV2を変更していく
/*
* IRremoteESP8266: IRrecvDumpV2 - dump details of IR codes with IRrecv
* An IR detector/demodulator must be connected to the input kRecvPin.
*
* Copyright 2009 Ken Shirriff, http://arcfn.com
* Copyright 2017-2019 David Conran
*
* Example circuit diagram:
* https://github.com/crankyoldgit/IRremoteESP8266/wiki#ir-receiving
*
@katsuyoshi
katsuyoshi / ContentView.swift
Created February 24, 2023 07:11
CoreDataのwillSave()を使う際はsetPrimitiveValue(:forkey:)を使う
import SwiftUI
import CoreData
struct ContentView: View {
@Environment(\.managedObjectContext) private var viewContext
@FetchRequest(
sortDescriptors: [NSSortDescriptor(keyPath: \Item.timestamp, ascending: true)],
animation: .default)
private var items: FetchedResults<Item>
#include <Arduino.h>
#include <FastLED.h>
#define LED_PIN 21
#define NUM_LEDS 1
static CRGB leds[NUM_LEDS];
void setLed(CRGB color) {
// change RGB to GRB
@katsuyoshi
katsuyoshi / ContetView.swift
Last active February 12, 2023 13:39
TextFieldでoptionalを扱う場合について
import SwiftUI
struct ModelView: View {
@ObservedObject var model: Model
@State var isEditing = false
var body: some View {
HStack {
Text(model.name)
@katsuyoshi
katsuyoshi / ContentView.swift
Last active February 10, 2023 07:57
SwiftUIでUndoManagerを試してみる
import SwiftUI
struct ContentView: View {
@ObservedObject var model = Model()
var body: some View {
VStack {
Toggle("On/Off", isOn: $model.isOn)
Spacer()
Button("Undo") {
@katsuyoshi
katsuyoshi / result
Created January 16, 2023 23:55
objcで [[self class] new] とするのを Swift で
Hello, I'm an instance of A.
Hello, I'm an instance of A.
Hello, I'm an instance of B.
Hello, I'm an instance of B.
@katsuyoshi
katsuyoshi / ContentView.swift
Last active January 9, 2023 16:23
TextViewについて
//
// ContentView.swift
// TextFieldPractice
//
// Created by Katsuyoshi Ito on 2023/01/10.
//
import SwiftUI
// CoreDataを想定してOptionalを扱うモデルを用意
@katsuyoshi
katsuyoshi / EPD_1in9.cpp
Last active January 30, 2023 05:39
M5Stamp picoで1.9inch Segment e-Paper Moduleのサンプルプログラムを試して見る。からの温湿度計に
#include <Wire.h>
#include <stdlib.h>
#include "EPD_1in9.h"
//////////////////////////////////////full screen update LUT////////////////////////////////////////////
unsigned char DSPNUM_1in9_on[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, }; // all black
unsigned char DSPNUM_1in9_off[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; // all white
unsigned char DSPNUM_1in9_WB[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, }; // All black font
unsigned char DSPNUM_1in9_W0[] = {0x00, 0xbf, 0x1f, 0xbf, 0x1f, 0xbf, 0x1f, 0xbf, 0x1f, 0xbf, 0x1f, 0xbf, 0x1f, 0x00, 0x00, }; // 0
@katsuyoshi
katsuyoshi / env.h
Last active December 23, 2022 04:57
雪寄せ時間を記録するためのM5StickCのプログラム
#ifndef __ENV_H__
#define __ENV_H__
#define WIFI_SSID "your wifi ssid"
#define WIFI_PASSWORD "your password for WIFI_SSID"
//#define WIFI_SSID_2 "your second wifi ssid if you have"
//#define WIFI_PASSWORD_2 "your password for WIFI_SSID2"
//#define WIFI_SSID_3 "your third wifi ssid if you have"
//#define WIFI_PASSWORD_3 "your password for WIFI_SSID3"