Compare commits
44 Commits
be59aecd50
...
main
Author | SHA1 | Date | |
---|---|---|---|
151318165b | |||
48ef973c54 | |||
92386202db | |||
246b58e7c4 | |||
820cea9bbf | |||
d09cbf8ad6 | |||
29c26d771a | |||
8ee23d17b0 | |||
a55ec54e8e | |||
0969b9b225 | |||
af03bf8fa1 | |||
34652408a0 | |||
8856df75df | |||
152d13bb76 | |||
e443f24f3c | |||
f0d101dc1d | |||
e12b63a238 | |||
eafe6966e4 | |||
1f48f1bb15 | |||
a8c6e06187 | |||
dd0fc02c48 | |||
597e3bba21 | |||
843a90a0cd | |||
f290b18722 | |||
b186d07973 | |||
13238c826d | |||
a9dc6549b1 | |||
7c6297bac9 | |||
4b35e15829 | |||
0aaa206e6a | |||
1e9f849d1e | |||
00a2ca1913 | |||
d5545e29aa | |||
716df973e0 | |||
3ed2354abe | |||
4469ba6e35 | |||
4b41b4bbd3 | |||
f69c693257 | |||
a06880b413 | |||
ea1dce3f3b | |||
0912532389 | |||
260dd3372a | |||
eebeea8f12 | |||
177ba68eea |
47
.gitea/workflows/ci.yaml
Normal file
@@ -0,0 +1,47 @@
|
||||
name: Build
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
jobs:
|
||||
build:
|
||||
env:
|
||||
RUNNER_TOOL_CACHE: /toolcache
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: git config --global core.quotepath false
|
||||
- name: Install apt packages
|
||||
run: apt update && apt install -y rsync
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 23
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: https://github.com/actions/setup-go@v4
|
||||
with:
|
||||
go-version: '^1.23'
|
||||
- name: Setup Hugo
|
||||
uses: https://github.com/peaceiris/actions-hugo@v2
|
||||
with:
|
||||
hugo-version: "latest"
|
||||
extended: true
|
||||
- name: Setup Hugo modules
|
||||
run: hugo mod get -u
|
||||
- name: Setup Hugo npm modules
|
||||
run: hugo mod npm pack
|
||||
- run: npm install
|
||||
- name: Run Hugo
|
||||
run: hugo --gc --minify
|
||||
# - name: upload artifacs
|
||||
# uses: https://github.com/actions/upload-artifact@v3
|
||||
# with:
|
||||
# name: "test2"
|
||||
# path: "public/**"
|
||||
- name: Create private key
|
||||
run: |
|
||||
echo "${{ secrets.PRIVATE_KEY }}" > /tmp/act_runner_key
|
||||
chmod 600 /tmp/act_runner_key
|
||||
- name: rsync public directory
|
||||
run: |
|
||||
rsync -avz --delete -e "ssh -i /tmp/act_runner_key -o StrictHostKeyChecking=no -p ${{ vars.WEBSERVER_PORT }}" ${{ gitea.workspace }}/public/* ${{ vars.WEBSERVER_USER }}@${{ vars.WEBSERVER_HOST }}:/var/www/html
|
4
.gitignore
vendored
@@ -1,3 +1,5 @@
|
||||
resources
|
||||
public/
|
||||
.DS_Store
|
||||
.DS_Store
|
||||
content/.obsidian
|
||||
node_modules
|
3
.gitmodules
vendored
@@ -1,3 +0,0 @@
|
||||
[submodule "themes/book"]
|
||||
path = themes/book
|
||||
url = https://github.com/tomoyanonymous/hugo-book.git
|
82
README.md
@@ -16,4 +16,84 @@ https://matsuuratomoya.com
|
||||
|
||||
授業関係の連絡はこちら↓ Related to courseworks
|
||||
|
||||
- teach\[at\]matsuuratomoya.com
|
||||
- teach\[at\]matsuuratomoya.com
|
||||
|
||||
|
||||
# 使い方のメモ
|
||||
|
||||
[hugo-book](https://github.com/alex-shpak/hugo-book)をベースに、いくつか手を加えている。
|
||||
|
||||
[hugo-micromorph](https://github.com/tomoyanonymous/hugo-micromorph)で読み込み速度をめっちゃ早くしている。
|
||||
|
||||
## インストール & ビルド
|
||||
|
||||
HugoとNode.jsを入れる。
|
||||
|
||||
```sh
|
||||
git clone gitea:tomoyanoynmous/teach-matsuuratomoya-com.git # giteaは~/.sshの中で設定すること
|
||||
hugo mod get -u
|
||||
hugo mod npm pack
|
||||
npm install
|
||||
hugo server
|
||||
```
|
||||
|
||||
## 新しい授業資料更新のファイル作成コマンド
|
||||
|
||||
```sh
|
||||
hugo new --kind class content/docs/2023/code-design/10
|
||||
```
|
||||
|
||||
## カスタムショートコード
|
||||
|
||||
テーマのショートコードも使える。 https://github.com/alex-shpak/hugo-book#shortcodes
|
||||
|
||||
CallOutは[hugo-admonition](https://github.com/KKKZOZ/hugo-admonitions)が使える。
|
||||
|
||||
FontAwesomeのIconも使える。 https://github.com/hugomods/icons/vendors/font-awesome
|
||||
|
||||
### `embed_pdf` PDFの埋め込み
|
||||
|
||||
embedで埋め込むだけ。Page Bundleになっている必要があるので`index.md`と同ディレクトリでないと使えない
|
||||
|
||||
```md
|
||||
{{< embed_pdf >}}
|
||||
```
|
||||
|
||||
mdと同ディレクトリにあるPDFのうち一番先頭のファイルを埋め込む。
|
||||
|
||||
```md
|
||||
---
|
||||
...
|
||||
params:
|
||||
pdf_path:hoge.pdf
|
||||
...
|
||||
---
|
||||
|
||||
{{< embed_pdf >}}
|
||||
```
|
||||
|
||||
フロントマッターで相対指定したPDFファイルを埋め込む。
|
||||
|
||||
```md
|
||||
{{< embed_pdf href = "hoge.pdf">}}
|
||||
```
|
||||
|
||||
インライン指定したPDFファイルを埋め込む。
|
||||
|
||||
### `slides_jpg`
|
||||
|
||||
```md
|
||||
{{< slides_jpg >}}
|
||||
```
|
||||
|
||||
Page Resourcesの中のJPGを全部名前順に連番で表示する。keynoteでjpgエクスポートした連番ファイルをそのまま突っ込んで表示できる想定。
|
||||
|
||||
### `preview_code`
|
||||
|
||||
指定したファイルを読み込んで通常のコードハイライト表示をし、ダウンロードのボタンを追加する。
|
||||
これも埋め込むファイルがPage Resourcesになっている必要がある(サブディレクトリに入れることはできない。)
|
||||
`type`でシンタックスハイライトの種類を指定できる。
|
||||
|
||||
```md
|
||||
{{< preview_code href="tone_minimal.ino" type= "ino">}}
|
||||
```
|
||||
|
18
archetypes/class/_index.en.md
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
title: Week N
|
||||
date: {{.Date}}
|
||||
weight: 1
|
||||
params:
|
||||
pdf_path: "hoge.pdf"
|
||||
draft: true
|
||||
---
|
||||
|
||||
# {{.Date| dateFormat "2006"}} Class Name / Week N
|
||||
|
||||
## Slides
|
||||
|
||||
{{< embed_pdf >}}
|
||||
|
||||
{{< button href=.Page.Params.pdf_path >}}Slides(PDF){{< /button >}}
|
||||
|
||||
{{< button href="slides">}}Slides(HTML){{< /button >}}
|
18
archetypes/class/_index.md
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
title: 第N週
|
||||
date: {{.Date}}
|
||||
weight: 1
|
||||
params:
|
||||
pdf_path: "hoge.pdf"
|
||||
draft: true
|
||||
---
|
||||
|
||||
# {{.Date| dateFormat "2006"}}年 授業名 第N回
|
||||
|
||||
## スライド
|
||||
|
||||
{{< embed_pdf >}}
|
||||
|
||||
{{< button href=.Page.Params.pdf_path >}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="slides">}}スライド(HTML){{< /button >}}
|
10
archetypes/class/slides/index.en.md
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: "Class Name {{.Date| dateFormat "2006"}} Week N Slides"
|
||||
date: {{.Date}}
|
||||
bookHidden: true
|
||||
---
|
||||
|
||||
|
||||
# Slides
|
||||
|
||||
{{< slides_jpg >}}
|
10
archetypes/class/slides/index.md
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: "授業名 {{.Date| dateFormat "2006"}}年 第N回 スライド"
|
||||
date: {{.Date}}
|
||||
bookHidden: true
|
||||
---
|
||||
|
||||
|
||||
# スライド
|
||||
|
||||
{{< slides_jpg >}}
|
18
assets/_custom.scss
Normal file
@@ -0,0 +1,18 @@
|
||||
body {
|
||||
//mod by tomoya
|
||||
font-family: "Helvetica Neue",
|
||||
Arial,
|
||||
"Hiragino Sans",
|
||||
"Hiragino Kaku Gothic ProN",
|
||||
Meiryo,
|
||||
sans-serif;
|
||||
font-feature-settings: "palt" 1;
|
||||
word-break: auto-phrase;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: monospace;
|
||||
}
|
||||
.book-brand .book-icon{
|
||||
filter:none;
|
||||
}
|
@@ -24,7 +24,7 @@ type: docs
|
||||
|
||||
近年の活動は電子音響楽器「Exidiophone」の制作とそれを用いた演奏活動、音楽プログラミング言語「mimium」の設計、開発(2019年度未踏IT人材発掘・育成事業採択、また2020年度同事業スーパークリエータ認定)など。
|
||||
|
||||
1994年生。2017年東京藝術大学 音楽学部音楽環境創造科卒業、2019年九州大学 大学院芸術工学府 修士課程修了。2018年School for Poetic Computation留学。2019年同大学院博士後期課程修了。博士(芸術工学)。
|
||||
1994年生。2017年東京藝術大学 音楽学部音楽環境創造科卒業、2019年九州大学 大学院芸術工学府 修士課程修了。2018年School for Poetic Computation留学。2022年同大学院博士後期課程修了。博士(芸術工学)。
|
||||
|
||||
2022年より[東京藝術大学芸術情報センター(AMC)](https://amc.geidai.ac.jp/lab/)特任助教。
|
||||
|
||||
@@ -49,6 +49,8 @@ Researchmap: <https://researchmap.jp/matsuuratomoya>
|
||||
|
||||
### [福岡女学院大学 「サウンド・デザイン」(夏季集中講義)](/docs/2022/fukujo-sounddesign)
|
||||
|
||||
### [電子基板制作WS – 東京藝大アートDX・芸術情報土木工学特別演習](/docs/2022/geidai-pcbws)
|
||||
|
||||
## [2021年度](/docs/2021)
|
||||
|
||||
### [福岡女学院大学 「サウンド・デザイン」](/docs/2021/fukujo-sounddesign)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 2020年度
|
||||
weight: 4
|
||||
weight: -1
|
||||
bookFlatSection: true
|
||||
---
|
||||
|
||||
|
@@ -29,4 +29,4 @@ weight: 1
|
||||
|
||||
{{< button href="20200430_sounddesign1.pdf">}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}スライド(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}スライド(HTML){{< /button >}}
|
||||
|
@@ -27,4 +27,4 @@ weight: 10
|
||||
|
||||
{{< button href="20200718_sounddesign10.pdf">}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}スライド(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}スライド(HTML){{< /button >}}
|
||||
|
@@ -14,4 +14,4 @@ weight: 11
|
||||
|
||||
{{< button href="20200721_sounddesign11.pdf">}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}スライド(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}スライド(HTML){{< /button >}}
|
||||
|
@@ -12,4 +12,4 @@ weight: 12
|
||||
|
||||
{{< button href="20200728_sounddesign12.pdf">}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}スライド(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}スライド(HTML){{< /button >}}
|
||||
|
@@ -11,4 +11,4 @@ weight: 13
|
||||
|
||||
{{< button href="20200729_sounddesign13.pdf">}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}スライド(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}スライド(HTML){{< /button >}}
|
||||
|
@@ -12,4 +12,4 @@ weight: 14
|
||||
|
||||
{{< button href="20200804_sounddesign14.pdf">}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}スライド(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}スライド(HTML){{< /button >}}
|
||||
|
@@ -12,4 +12,4 @@ weight: 15
|
||||
|
||||
{{< button href="20200806_sounddesign15.pdf">}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}スライド(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}スライド(HTML){{< /button >}}
|
||||
|
@@ -37,4 +37,4 @@ weight: 2
|
||||
|
||||
{{< button href="20200507_sounddesign2.pdf">}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}スライド(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}スライド(HTML){{< /button >}}
|
||||
|
@@ -30,7 +30,7 @@ weight: 3
|
||||
|
||||
{{< button href="20200514_sounddesign3.pdf">}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}スライド(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}スライド(HTML){{< /button >}}
|
||||
|
||||
## 非圧縮サンプル音声(ファイル名はスライド参照)
|
||||
|
||||
|
@@ -13,4 +13,4 @@ weight: 4
|
||||
|
||||
{{< button href="20200625_sounddesign4.pdf">}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}スライド(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}スライド(HTML){{< /button >}}
|
||||
|
@@ -12,4 +12,4 @@ weight: 5
|
||||
|
||||
{{< button href="20200702_sounddesign5.pdf">}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}スライド(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}スライド(HTML){{< /button >}}
|
||||
|
@@ -12,4 +12,4 @@ weight: 6
|
||||
|
||||
{{< button href="20200708_sounddesign6.pdf">}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}スライド(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}スライド(HTML){{< /button >}}
|
||||
|
@@ -12,4 +12,4 @@ weight: 7
|
||||
|
||||
{{< button href="20200711_sounddesign7.pdf">}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}スライド(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}スライド(HTML){{< /button >}}
|
||||
|
@@ -12,4 +12,4 @@ weight: 8
|
||||
|
||||
{{< button href="20200714_sounddesign8.pdf">}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}スライド(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}スライド(HTML){{< /button >}}
|
||||
|
@@ -12,4 +12,4 @@ weight: 9
|
||||
|
||||
{{< button href="20200716_sounddesign9.pdf">}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}スライド(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}スライド(HTML){{< /button >}}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 2021年度
|
||||
weight: 3
|
||||
weight: -2
|
||||
bookFlatSection: true
|
||||
---
|
||||
|
||||
|
@@ -13,5 +13,5 @@ weight: 1
|
||||
|
||||
{{< button href="20210415_sounddesign1.pdf">}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}スライド(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}スライド(HTML){{< /button >}}
|
||||
|
||||
|
@@ -12,7 +12,7 @@ weight: 10
|
||||
|
||||
{{< button href="20210610_sounddesign10.pdf">}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}スライド(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}スライド(HTML){{< /button >}}
|
||||
|
||||
{{< button href="./20210610_missingfun.pd">}}ミッシングファンダメンタル サンプルパッチ{{< /button >}}
|
||||
|
||||
|
@@ -12,6 +12,6 @@ weight: 11
|
||||
|
||||
{{< button href="20210617_sounddesign11.pdf">}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}スライド(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}スライド(HTML){{< /button >}}
|
||||
|
||||
{{< button href="./20210617_stereopan_eqpower.pd">}}ステレオ等価パワーパンナー サンプルパッチ{{< /button >}}
|
@@ -12,5 +12,5 @@ weight: 12
|
||||
|
||||
{{< button href="20210624_sounddesign12.pdf">}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}スライド(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}スライド(HTML){{< /button >}}
|
||||
|
||||
|
@@ -12,5 +12,5 @@ weight: 13
|
||||
|
||||
{{< button href="20210701_sounddesign13.pdf">}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}スライド(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}スライド(HTML){{< /button >}}
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 第14週
|
||||
date: 2021-0708
|
||||
date: 2021-07-08
|
||||
weight: 14
|
||||
---
|
||||
|
||||
@@ -12,7 +12,7 @@ weight: 14
|
||||
|
||||
{{< button href="20210708_sounddesign14.pdf">}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}スライド(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}スライド(HTML){{< /button >}}
|
||||
|
||||
|
||||
## 最終課題 サンプルパッチ
|
||||
|
@@ -13,5 +13,5 @@ weight: 2
|
||||
|
||||
{{< button href="20210422_sounddesign2.pdf">}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}スライド(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}スライド(HTML){{< /button >}}
|
||||
|
||||
|
@@ -13,5 +13,5 @@ weight: 3
|
||||
|
||||
{{< button href="20210506_sounddesign3.pdf">}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}スライド(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}スライド(HTML){{< /button >}}
|
||||
|
||||
|
@@ -12,5 +12,5 @@ weight: 4
|
||||
|
||||
{{< button href="20210508_sounddesign4.pdf">}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}スライド(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}スライド(HTML){{< /button >}}
|
||||
|
||||
|
@@ -12,5 +12,5 @@ weight: 5
|
||||
|
||||
{{< button href="20210513_sounddesign5.pdf">}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}スライド(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}スライド(HTML){{< /button >}}
|
||||
|
||||
|
@@ -12,5 +12,5 @@ weight: 6
|
||||
|
||||
{{< button href="20210520_sounddesign6.pdf">}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}スライド(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}スライド(HTML){{< /button >}}
|
||||
|
||||
|
@@ -12,5 +12,5 @@ weight: 7
|
||||
|
||||
{{< button href="20210527_sounddesign7.pdf">}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}スライド(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}スライド(HTML){{< /button >}}
|
||||
|
||||
|
@@ -12,5 +12,5 @@ weight: 8
|
||||
|
||||
{{< button href="20210603_sounddesign8.pdf">}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}スライド(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}スライド(HTML){{< /button >}}
|
||||
|
||||
|
@@ -12,7 +12,7 @@ weight: 9
|
||||
|
||||
{{< button href="20210605_sounddesign9.pdf">}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}スライド(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}スライド(HTML){{< /button >}}
|
||||
|
||||
## クリティカル・リスニング サンプル音源
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 2022年度
|
||||
weight: 2
|
||||
weight: -3
|
||||
bookFlatSection: true
|
||||
---
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 2023
|
||||
weight: 1
|
||||
weight: -4
|
||||
bookFlatSection: true
|
||||
---
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 2023年度
|
||||
weight: 1
|
||||
weight: -5
|
||||
bookFlatSection: true
|
||||
---
|
||||
|
||||
@@ -17,6 +17,9 @@ bookFlatSection: true
|
||||
|
||||
講師:松浦知也
|
||||
|
||||
# 2023年 東京藝術大学 芸術情報センター開設科目 「メディア特論」(通年 水曜6限隔週)(ゲスト講義のため資料なし)
|
||||
|
||||
|
||||
|
||||
# [2023年 福岡女学院大学 「サウンド・デザイン」(夏季集中講義)](fukujo-sounddesign)
|
||||
|
||||
|
@@ -10,5 +10,5 @@ weight: 1
|
||||
|
||||
{{< button href="2023-code-and-design-1.pdf">}}Slides(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}Slides(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}Slides(HTML){{< /button >}}
|
||||
|
||||
|
BIN
content/docs/2023/code-design/11/2023-code-and-design-11.pdf
Normal file
13
content/docs/2023/code-design/11/_index.en.md
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
title: Week 11
|
||||
date: 2023-06-23
|
||||
weight: 11
|
||||
params:
|
||||
pdf_path: 2023-code-and-design-11.pdf
|
||||
---
|
||||
|
||||
# 2023 Tokyo University of the Arts Art media Center「Code and Design」 Week 11
|
||||
|
||||
## Slide
|
||||
|
||||
{{< embed_pdf >}}
|
13
content/docs/2023/code-design/11/_index.md
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
title: 第11週
|
||||
date: 2023-06-23
|
||||
weight: 11
|
||||
params:
|
||||
pdf_path: 2023-code-and-design-11.pdf
|
||||
---
|
||||
|
||||
# 2023年 東京藝術大学 芸術情報センター開設科目 「コードとデザイン」 第11回
|
||||
|
||||
## スライド
|
||||
|
||||
{{< embed_pdf >}}
|
13
content/docs/2023/code-design/13/_index.en.md
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
title: Week 11
|
||||
date: 2023-06-23
|
||||
weight: 11
|
||||
params:
|
||||
pdf_path: 2023-code-and-design-11.pdf
|
||||
---
|
||||
|
||||
# 2023 Tokyo University of the Arts Art media Center「Code and Design」 Week 11
|
||||
|
||||
## Slide
|
||||
|
||||
{{< embed_pdf >}}
|
61
content/docs/2023/code-design/13/_index.md
Normal file
@@ -0,0 +1,61 @@
|
||||
---
|
||||
title: 第13週
|
||||
date: 2023-06-23
|
||||
weight: 13
|
||||
---
|
||||
|
||||
# 2023年 東京藝術大学 芸術情報センター開設科目 「コードとデザイン」 第13回
|
||||
|
||||
## スライド
|
||||
|
||||
(スライド行方不明・・・多分この日はスライドなかったと思います)
|
||||
|
||||
## 銅箔テープで作る平面コイルのSVGを出力するProcessingスケッチ
|
||||
|
||||
|
||||
|
||||
```java
|
||||
import processing.svg.*;
|
||||
|
||||
void setup(){
|
||||
noLoop();
|
||||
size(800,800);
|
||||
stroke(0);
|
||||
background(255);
|
||||
beginRecord(SVG, "spiral.svg");
|
||||
|
||||
}
|
||||
|
||||
float diameter = 800;
|
||||
|
||||
|
||||
void draw(){
|
||||
float angle = 0;
|
||||
float r = 1;
|
||||
float r_step =0.4;
|
||||
float angle_step = 0.1;
|
||||
translate(width/2,height/2);
|
||||
float x_tmp = 0;
|
||||
float y_tmp = 0;
|
||||
while(r < width/2-10){
|
||||
r += r_step;
|
||||
angle += angle_step;
|
||||
float x = r*sin(angle);
|
||||
float y = r*cos(angle);
|
||||
line(x_tmp,y_tmp,x,y);
|
||||
x_tmp = x;
|
||||
y_tmp = y;
|
||||
}
|
||||
r+=9;
|
||||
while(r > 0){
|
||||
r -= r_step;
|
||||
angle -= angle_step;
|
||||
float x = r*sin(angle);
|
||||
float y = r*cos(angle);
|
||||
line(x_tmp,y_tmp,x,y);
|
||||
x_tmp = x;
|
||||
y_tmp = y;
|
||||
}
|
||||
endRecord();
|
||||
}
|
||||
```
|
43
content/docs/2023/code-design/13/svg_spiral.pde
Normal file
@@ -0,0 +1,43 @@
|
||||
import processing.svg.*;
|
||||
|
||||
void setup(){
|
||||
noLoop();
|
||||
size(800,800);
|
||||
stroke(0);
|
||||
background(255);
|
||||
beginRecord(SVG, "spiral.svg");
|
||||
|
||||
}
|
||||
|
||||
float diameter = 800;
|
||||
|
||||
|
||||
void draw(){
|
||||
float angle = 0;
|
||||
float r = 1;
|
||||
float r_step =0.4;
|
||||
float angle_step = 0.1;
|
||||
translate(width/2,height/2);
|
||||
float x_tmp = 0;
|
||||
float y_tmp = 0;
|
||||
while(r < width/2-10){
|
||||
r += r_step;
|
||||
angle += angle_step;
|
||||
float x = r*sin(angle);
|
||||
float y = r*cos(angle);
|
||||
line(x_tmp,y_tmp,x,y);
|
||||
x_tmp = x;
|
||||
y_tmp = y;
|
||||
}
|
||||
r+=9;
|
||||
while(r > 0){
|
||||
r -= r_step;
|
||||
angle -= angle_step;
|
||||
float x = r*sin(angle);
|
||||
float y = r*cos(angle);
|
||||
line(x_tmp,y_tmp,x,y);
|
||||
x_tmp = x;
|
||||
y_tmp = y;
|
||||
}
|
||||
endRecord();
|
||||
}
|
@@ -10,5 +10,5 @@ weight: 2
|
||||
|
||||
{{< button href="2023-code-and-design-2.pdf">}}Slides(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}Slides(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}Slides(HTML){{< /button >}}
|
||||
|
||||
|
@@ -10,5 +10,5 @@ weight: 3
|
||||
|
||||
{{< button href="2023-code-and-design-3.pdf">}}Slides(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}Slides(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}Slides(HTML){{< /button >}}
|
||||
|
||||
|
@@ -10,5 +10,5 @@ weight: 4
|
||||
|
||||
{{< button href="2023-code-and-design-4.pdf">}}Slides(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}Slides(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}Slides(HTML){{< /button >}}
|
||||
|
||||
|
@@ -10,5 +10,5 @@ weight: 5
|
||||
|
||||
{{< button href="2023-code-and-design-5.pdf">}}Slides(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}Slides(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}Slides(HTML){{< /button >}}
|
||||
|
||||
|
@@ -10,5 +10,5 @@ weight: 6
|
||||
|
||||
{{< button href="2023-code-and-design-6.pdf">}}Slides(PDF){{< /button >}}
|
||||
|
||||
{{< button href="./slides">}}Slides(HTML){{< /button >}}
|
||||
{{< button relref="./slides">}}Slides(HTML){{< /button >}}
|
||||
|
||||
|
BIN
content/docs/2023/code-design/7/2023-code-and-design-7.pdf
Normal file
152
content/docs/2023/code-design/7/_index.en.md
Normal file
@@ -0,0 +1,152 @@
|
||||
---
|
||||
title: Week 7
|
||||
date: 2023-05-26
|
||||
weight: 7
|
||||
---
|
||||
|
||||
# 2023 Tokyo University of the Arts Art media Center「Code and Design」
|
||||
|
||||
## Slides (in Japanese)
|
||||
|
||||
{{< button href="2023-code-and-design-7.pdf">}}Slides(PDF){{< /button >}}
|
||||
|
||||
{{< button relref="./slides">}}Slides(HTML){{< /button >}}
|
||||
|
||||
|
||||
## Python Scripts for Mouse Automation
|
||||
|
||||
https://github.com/tomoyanonymous/py-serial-automouse
|
||||
|
||||
{{< button href="https://github.com/tomoyanonymous/py-serial-automouse/archive/refs/heads/main.zip">}} DL Zip {{< /button >}}
|
||||
|
||||
## Arduino Example Codes
|
||||
|
||||
### ADCTouch_monitor.ino
|
||||
|
||||
{{< button href="./ADCTouch_monitor/ADCTouch_monitor.ino">}}DL{{< /button >}}
|
||||
|
||||
```cpp
|
||||
#include <ADCTouch.h>
|
||||
void setup() {
|
||||
pinMode(A0, INPUT);
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
Serial.begin(9600);
|
||||
}
|
||||
void loop() {
|
||||
int val = ADCTouch.read(A0, 100);
|
||||
Serial.println(val);
|
||||
delay(40);
|
||||
}
|
||||
```
|
||||
|
||||
### ADCTouch_minimal.ino
|
||||
|
||||
{{< button href="./ADCTouch_minimal/ADCTouch_minimal.ino">}}DL{{< /button >}}
|
||||
|
||||
```cpp
|
||||
#include <ADCTouch.h>
|
||||
//setup()とloop()で共通して使う値はグローバル変数(関数の外側)で定義しておく
|
||||
int ref = 0;
|
||||
|
||||
void setup() {
|
||||
pinMode(A0, INPUT);
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
Serial.begin(9600);
|
||||
//繋げた導体の状態で初期値が変わるので、それを保存しておく必要がある
|
||||
ref = ADCTouch.read(A0, 100); //(使用するピン番号,平均を取るサンプル数)
|
||||
}
|
||||
void loop() {
|
||||
int val = ADCTouch.read(A0, 100) - ref;
|
||||
if (val > 40) {
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
} else {
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
}
|
||||
Serial.println(val);
|
||||
delay(40);
|
||||
}
|
||||
```
|
||||
|
||||
### ADCTouch_Mouse
|
||||
|
||||
{{< button href="./ADCTouch_Mouse/ADCTouch_Mouse.ino">}}DL{{< /button >}}
|
||||
|
||||
```cpp
|
||||
#include <ADCTouch.h>
|
||||
|
||||
const int upButton = A0;
|
||||
const int downButton = A1;
|
||||
const int leftButton = A2;
|
||||
const int rightButton = A3;
|
||||
const int mouseButton = A4;
|
||||
int ref_up = 0;
|
||||
int ref_down = 0;
|
||||
int ref_left = 0;
|
||||
int ref_right = 0;
|
||||
int ref_mouse = 0;
|
||||
|
||||
int range = 10; // マウスカーソルの移動幅
|
||||
|
||||
void setup() {
|
||||
pinMode(upButton, INPUT);
|
||||
pinMode(downButton, INPUT);
|
||||
pinMode(leftButton, INPUT);
|
||||
pinMode(rightButton, INPUT);
|
||||
pinMode(mouseButton, INPUT);
|
||||
|
||||
ref_up = ADCTouch.read(upButton, 100);
|
||||
ref_down = ADCTouch.read(downButton, 100);
|
||||
ref_left = ADCTouch.read(leftButton, 100);
|
||||
ref_right = ADCTouch.read(rightButton, 100);
|
||||
ref_mouse = ADCTouch.read(mouseButton, 100);
|
||||
|
||||
Serial.begin(9600);
|
||||
}
|
||||
|
||||
//マウス移動に関する処理をひとまとめに
|
||||
void moveMouse(int x, int y, int mouse_state) {
|
||||
Serial.print(x);
|
||||
Serial.print(" ");
|
||||
Serial.print(y);
|
||||
Serial.print(" ");
|
||||
Serial.println(mouse_state);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// ボタンの検出
|
||||
int v1 = ADCTouch.read(upButton, 100) - ref_up;
|
||||
int v2 = ADCTouch.read(downButton, 100) - ref_down;
|
||||
int v3 = ADCTouch.read(leftButton, 100) - ref_left;
|
||||
int v4 = ADCTouch.read(rightButton, 100) - ref_right;
|
||||
int v5 = ADCTouch.read(mouseButton, 100) - ref_mouse;
|
||||
//40以上ならクリックしたとみなし、1を、40以下なら0を
|
||||
// A ? B : C;はif (A) { return B;} else {return C;} の略記(三項演算子)
|
||||
int upState = v1 > 40 ? 1 : 0;
|
||||
int downState = v2 > 40 ? 1 : 0;
|
||||
int rightState = v3 > 40 ? 1 : 0;
|
||||
int leftState = v4 > 40 ? 1 : 0;
|
||||
int clickState = v5 > 40 ? 1 : 0;
|
||||
// 移動距離を算出(左右同時押しも考慮)
|
||||
int xDistance = (leftState - rightState) * range;
|
||||
int yDistance = (upState - downState) * range;
|
||||
|
||||
//移動もクリックもしてないならシリアル送信は冗長なので、しない
|
||||
// && は AND、!はNOT
|
||||
if (!(xDistance == 0 && yDistance == 0 && clickState == 0)) {
|
||||
moveMouse(xDistance, yDistance, clickState);
|
||||
}
|
||||
delay(5);
|
||||
}
|
||||
```
|
||||
|
||||
### DrunkMouse(Add Randomness)
|
||||
|
||||
{{< button href="./DrunkMouse/DrunkMouse.ino">}}DL{{< /button >}}
|
||||
|
||||
### ADCTouch_Mouse_HID.ino (Only works for Leonardo and Pro Micro)
|
||||
|
||||
{{< button href="./ADCTouch_Mouse_HID/ADCTouch_Mouse_HID.ino">}}DL{{< /button >}}
|
||||
|
||||
### ADCTouch_Mouse_scroll.ino(works only with `move_relative_scroll.command`)
|
||||
|
||||
{{< button href="./ADCTouch_Mouse_scroll/ADCTouch_Mouse_scroll.ino">}}DL{{< /button >}}
|
151
content/docs/2023/code-design/7/_index.md
Normal file
@@ -0,0 +1,151 @@
|
||||
---
|
||||
title: 第7週
|
||||
date: 2023-05-26
|
||||
weight: 7
|
||||
---
|
||||
|
||||
# 2023年 東京藝術大学 芸術情報センター開設科目 「コードとデザイン」 第7回
|
||||
|
||||
## スライド
|
||||
|
||||
{{< button href="2023-code-and-design-7.pdf">}}スライド(PDF){{< /button >}}
|
||||
|
||||
{{< button href="slides">}}スライド(HTML){{< /button >}}
|
||||
|
||||
## マウスを動かすためのPythonスクリプト
|
||||
|
||||
https://github.com/tomoyanonymous/py-serial-automouse
|
||||
|
||||
{{< button href="https://github.com/tomoyanonymous/py-serial-automouse/archive/refs/heads/main.zip">}} DL Zip {{< /button >}}
|
||||
|
||||
## Arduinoサンプルコード
|
||||
|
||||
### ADCTouch_monitor.ino
|
||||
|
||||
{{< button href="examples/ADCTouch_monitor/ADCTouch_monitor.ino">}}DL{{< /button >}}
|
||||
|
||||
```cpp
|
||||
#include <ADCTouch.h>
|
||||
void setup() {
|
||||
pinMode(A0, INPUT);
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
Serial.begin(9600);
|
||||
}
|
||||
void loop() {
|
||||
int val = ADCTouch.read(A0, 100);
|
||||
Serial.println(val);
|
||||
delay(40);
|
||||
}
|
||||
```
|
||||
|
||||
### ADCTouch_minimal.ino
|
||||
|
||||
{{< button href="examples/ADCTouch_minimal/ADCTouch_minimal.ino">}}DL{{< /button >}}
|
||||
|
||||
```cpp
|
||||
#include <ADCTouch.h>
|
||||
//setup()とloop()で共通して使う値はグローバル変数(関数の外側)で定義しておく
|
||||
int ref = 0;
|
||||
|
||||
void setup() {
|
||||
pinMode(A0, INPUT);
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
Serial.begin(9600);
|
||||
//繋げた導体の状態で初期値が変わるので、それを保存しておく必要がある
|
||||
ref = ADCTouch.read(A0, 100); //(使用するピン番号,平均を取るサンプル数)
|
||||
}
|
||||
void loop() {
|
||||
int val = ADCTouch.read(A0, 100) - ref;
|
||||
if (val > 40) {
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
} else {
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
}
|
||||
Serial.println(val);
|
||||
delay(40);
|
||||
}
|
||||
```
|
||||
|
||||
### ADCTouch_Mouse
|
||||
|
||||
{{< button href="examples/ADCTouch_Mouse/ADCTouch_Mouse.ino">}}DL{{< /button >}}
|
||||
|
||||
```cpp
|
||||
#include <ADCTouch.h>
|
||||
|
||||
const int upButton = A0;
|
||||
const int downButton = A1;
|
||||
const int leftButton = A2;
|
||||
const int rightButton = A3;
|
||||
const int mouseButton = A4;
|
||||
int ref_up = 0;
|
||||
int ref_down = 0;
|
||||
int ref_left = 0;
|
||||
int ref_right = 0;
|
||||
int ref_mouse = 0;
|
||||
|
||||
int range = 10; // マウスカーソルの移動幅
|
||||
|
||||
void setup() {
|
||||
pinMode(upButton, INPUT);
|
||||
pinMode(downButton, INPUT);
|
||||
pinMode(leftButton, INPUT);
|
||||
pinMode(rightButton, INPUT);
|
||||
pinMode(mouseButton, INPUT);
|
||||
|
||||
ref_up = ADCTouch.read(upButton, 100);
|
||||
ref_down = ADCTouch.read(downButton, 100);
|
||||
ref_left = ADCTouch.read(leftButton, 100);
|
||||
ref_right = ADCTouch.read(rightButton, 100);
|
||||
ref_mouse = ADCTouch.read(mouseButton, 100);
|
||||
|
||||
Serial.begin(9600);
|
||||
}
|
||||
|
||||
//マウス移動に関する処理をひとまとめに
|
||||
void moveMouse(int x, int y, int mouse_state) {
|
||||
Serial.print(x);
|
||||
Serial.print(" ");
|
||||
Serial.print(y);
|
||||
Serial.print(" ");
|
||||
Serial.println(mouse_state);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// ボタンの検出
|
||||
int v1 = ADCTouch.read(upButton, 100) - ref_up;
|
||||
int v2 = ADCTouch.read(downButton, 100) - ref_down;
|
||||
int v3 = ADCTouch.read(leftButton, 100) - ref_left;
|
||||
int v4 = ADCTouch.read(rightButton, 100) - ref_right;
|
||||
int v5 = ADCTouch.read(mouseButton, 100) - ref_mouse;
|
||||
//40以上ならクリックしたとみなし、1を、40以下なら0を
|
||||
// A ? B : C;はif (A) { return B;} else {return C;} の略記(三項演算子)
|
||||
int upState = v1 > 40 ? 1 : 0;
|
||||
int downState = v2 > 40 ? 1 : 0;
|
||||
int rightState = v3 > 40 ? 1 : 0;
|
||||
int leftState = v4 > 40 ? 1 : 0;
|
||||
int clickState = v5 > 40 ? 1 : 0;
|
||||
// 移動距離を算出(左右同時押しも考慮)
|
||||
int xDistance = (leftState - rightState) * range;
|
||||
int yDistance = (upState - downState) * range;
|
||||
|
||||
//移動もクリックもしてないならシリアル送信は冗長なので、しない
|
||||
// && は AND、!はNOT
|
||||
if (!(xDistance == 0 && yDistance == 0 && clickState == 0)) {
|
||||
moveMouse(xDistance, yDistance, clickState);
|
||||
}
|
||||
delay(5);
|
||||
}
|
||||
```
|
||||
|
||||
### DrunkMouse(ランダム性の追加)
|
||||
|
||||
{{< button href="examples/DrunkMouse/DrunkMouse.ino">}}DL{{< /button >}}
|
||||
|
||||
### ADCTouch_Mouse_HID.ino (Leonardo、Pro Microのみ)
|
||||
|
||||
{{< button href="examples/ADCTouch_Mouse_HID/ADCTouch_Mouse_HID.ino">}}DL{{< /button >}}
|
||||
|
||||
### ADCTouch_Mouse_scroll.ino(move_relative_scroll.commandと合わせて使う事)
|
||||
|
||||
{{< button href="examples/ADCTouch_Mouse_scroll/ADCTouch_Mouse_scroll.ino">}}DL{{< /button >}}
|
@@ -0,0 +1,66 @@
|
||||
#include <ADCTouch.h>
|
||||
|
||||
const int upButton = A0;
|
||||
const int downButton = A1;
|
||||
const int leftButton = A2;
|
||||
const int rightButton = A3;
|
||||
const int mouseButton = A4;
|
||||
int ref_up = 0;
|
||||
int ref_down = 0;
|
||||
int ref_left = 0;
|
||||
int ref_right = 0;
|
||||
int ref_mouse = 0;
|
||||
|
||||
int range = 10; // マウスカーソルの移動幅
|
||||
|
||||
void setup() {
|
||||
pinMode(upButton, INPUT);
|
||||
pinMode(downButton, INPUT);
|
||||
pinMode(leftButton, INPUT);
|
||||
pinMode(rightButton, INPUT);
|
||||
pinMode(mouseButton, INPUT);
|
||||
|
||||
ref_up = ADCTouch.read(upButton, 100);
|
||||
ref_down = ADCTouch.read(downButton, 100);
|
||||
ref_left = ADCTouch.read(leftButton, 100);
|
||||
ref_right = ADCTouch.read(rightButton, 100);
|
||||
ref_mouse = ADCTouch.read(mouseButton, 100);
|
||||
|
||||
Serial.begin(9600);
|
||||
}
|
||||
|
||||
//マウス移動に関する処理をひとまとめに
|
||||
void moveMouse(int x, int y, int mouse_state) {
|
||||
Serial.print(x);
|
||||
Serial.print(" ");
|
||||
Serial.print(y);
|
||||
Serial.print(" ");
|
||||
Serial.println(mouse_state);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// ボタンの検出
|
||||
int v1 = ADCTouch.read(upButton, 100) - ref_up;
|
||||
int v2 = ADCTouch.read(downButton, 100) - ref_down;
|
||||
int v3 = ADCTouch.read(leftButton, 100) - ref_left;
|
||||
int v4 = ADCTouch.read(rightButton, 100) - ref_right;
|
||||
int v5 = ADCTouch.read(mouseButton, 100) - ref_mouse;
|
||||
//40以上ならクリックしたとみなし、1を、40以下なら0を
|
||||
// A ? B : C;はif (A) { return B;} else {return C;} の略記(三項演算子)
|
||||
int upState = v1 > 40 ? 1 : 0;
|
||||
int downState = v2 > 40 ? 1 : 0;
|
||||
int rightState = v3 > 40 ? 1 : 0;
|
||||
int leftState = v4 > 40 ? 1 : 0;
|
||||
int clickState = v5 > 40 ? 1 : 0;
|
||||
// 移動距離を算出(左右同時押しも考慮)
|
||||
int xDistance = (leftState - rightState) * range;
|
||||
int yDistance = (upState - downState) * range;
|
||||
|
||||
//移動もクリックもしてないならシリアル送信は冗長なので、しない
|
||||
// && は AND、!はNOT
|
||||
if (!(xDistance == 0 && yDistance == 0 && clickState == 0)) {
|
||||
moveMouse(xDistance, yDistance, clickState);
|
||||
}
|
||||
|
||||
delay(5);
|
||||
}
|
@@ -0,0 +1,70 @@
|
||||
// Arduino Leonardo,Arduino Micro,Sparkfun Pro Microなど、ATMega32u4チップのものを使うこと
|
||||
|
||||
#include <Mouse.h>
|
||||
#include <ADCTouch.h>
|
||||
|
||||
const int upButton = A0;
|
||||
const int downButton = A1;
|
||||
const int leftButton = A2;
|
||||
const int rightButton = A3;
|
||||
const int mouseButton = A4;
|
||||
int ref_up = 0;
|
||||
int ref_down = 0;
|
||||
int ref_left = 0;
|
||||
int ref_right = 0;
|
||||
int ref_mouse = 0;
|
||||
|
||||
int range = 10;
|
||||
|
||||
void setup() {
|
||||
pinMode(upButton, INPUT);
|
||||
pinMode(downButton, INPUT);
|
||||
pinMode(leftButton, INPUT);
|
||||
pinMode(rightButton, INPUT);
|
||||
pinMode(mouseButton, INPUT);
|
||||
|
||||
ref_up = ADCTouch.read(upButton, 100);
|
||||
ref_down = ADCTouch.read(downButton, 100);
|
||||
ref_left = ADCTouch.read(leftButton, 100);
|
||||
ref_right = ADCTouch.read(rightButton, 100);
|
||||
ref_mouse = ADCTouch.read(mouseButton, 100);
|
||||
|
||||
Serial.begin(9600);
|
||||
}
|
||||
void moveMouse(int x, int y, int mouse_state) {
|
||||
Mouse.move(x, y, 0);
|
||||
if (mouse_state == 1) {
|
||||
if (!Mouse.isPressed(MOUSE_LEFT)) {
|
||||
Mouse.press(MOUSE_LEFT);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (Mouse.isPressed(MOUSE_LEFT)) {
|
||||
Mouse.release(MOUSE_LEFT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
int v1 = ADCTouch.read(upButton, 100) - ref_up;
|
||||
int v2 = ADCTouch.read(downButton, 100) - ref_down;
|
||||
int v3 = ADCTouch.read(leftButton, 100) - ref_left;
|
||||
int v4 = ADCTouch.read(rightButton, 100) - ref_right;
|
||||
int v5 = ADCTouch.read(mouseButton, 100) - ref_mouse;
|
||||
int upState = v1 > 40 ? 1 : 0;
|
||||
int downState = v2 > 40 ? 1 : 0;
|
||||
int rightState = v3 > 40 ? 1 : 0;
|
||||
int leftState = v4 > 40 ? 1 : 0;
|
||||
int clickState = v5 > 40 ? 1 : 0;
|
||||
|
||||
int xDistance = (leftState - rightState) * range;
|
||||
int yDistance = (upState - downState) * range;
|
||||
|
||||
|
||||
if (!(xDistance == 0 && yDistance == 0 && clickState == 0)) {
|
||||
moveMouse(xDistance, yDistance, clickState);
|
||||
}
|
||||
|
||||
delay(5);
|
||||
}
|
@@ -0,0 +1,78 @@
|
||||
#include <ADCTouch.h>
|
||||
|
||||
const int upButton = A0;
|
||||
const int downButton = A1;
|
||||
const int leftButton = A2;
|
||||
const int rightButton = A3;
|
||||
const int mouseButton = A4;
|
||||
const int scrollButton = A5;
|
||||
|
||||
int ref_up = 0;
|
||||
int ref_down = 0;
|
||||
int ref_left = 0;
|
||||
int ref_right = 0;
|
||||
int ref_mouse = 0;
|
||||
int ref_scroll = 0;
|
||||
|
||||
|
||||
int range = 10; // マウスカーソルの移動幅
|
||||
|
||||
void setup() {
|
||||
pinMode(upButton, INPUT);
|
||||
pinMode(downButton, INPUT);
|
||||
pinMode(leftButton, INPUT);
|
||||
pinMode(rightButton, INPUT);
|
||||
pinMode(mouseButton, INPUT);
|
||||
pinMode(scrollButton, INPUT);
|
||||
|
||||
ref_up = ADCTouch.read(upButton, 100);
|
||||
ref_down = ADCTouch.read(downButton, 100);
|
||||
ref_left = ADCTouch.read(leftButton, 100);
|
||||
ref_right = ADCTouch.read(rightButton, 100);
|
||||
ref_mouse = ADCTouch.read(mouseButton, 100);
|
||||
ref_scroll = ADCTouch.read(scrollButton, 100);
|
||||
|
||||
Serial.begin(9600);
|
||||
}
|
||||
|
||||
//マウス移動に関する処理をひとまとめに
|
||||
void moveMouse(int x, int y, int mouse_state, int scroll=0) {
|
||||
Serial.print(x);
|
||||
Serial.print(" ");
|
||||
Serial.print(y);
|
||||
Serial.print(" ");
|
||||
Serial.print(mouse_state);
|
||||
Serial.print(" ");
|
||||
Serial.println(scroll);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// ボタンの検出
|
||||
int v1 = ADCTouch.read(upButton, 100) - ref_up;
|
||||
int v2 = ADCTouch.read(downButton, 100) - ref_down;
|
||||
int v3 = ADCTouch.read(leftButton, 100) - ref_left;
|
||||
int v4 = ADCTouch.read(rightButton, 100) - ref_right;
|
||||
int v5 = ADCTouch.read(mouseButton, 100) - ref_mouse;
|
||||
int v6 = ADCTouch.read(scrollButton, 100) - ref_scroll;
|
||||
|
||||
//40以上ならクリックしたとみなし、1を、40以下なら0を
|
||||
// A ? B : C;はif (A) { return B;} else {return C;} の略記(三項演算子)
|
||||
int upState = v1 > 40 ? 1 : 0;
|
||||
int downState = v2 > 40 ? 1 : 0;
|
||||
int rightState = v3 > 40 ? 1 : 0;
|
||||
int leftState = v4 > 40 ? 1 : 0;
|
||||
int clickState = v5 > 40 ? 1 : 0;
|
||||
int scrollState = v6 > 20 ? (v6 > 200 ? 1 : -1) : 0;
|
||||
|
||||
// 移動距離を算出(左右同時押しも考慮)
|
||||
int xDistance = (leftState - rightState) * range;
|
||||
int yDistance = (upState - downState) * range;
|
||||
|
||||
//移動もクリックもしてないならシリアル送信は冗長なので、しない
|
||||
// && は AND、!はNOT
|
||||
if (!(xDistance == 0 && yDistance == 0 && clickState == 0 && scrollState == 0)) {
|
||||
moveMouse(xDistance, yDistance, clickState,scrollState);
|
||||
}
|
||||
|
||||
delay(5);
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
|
||||
#include <ADCTouch.h>
|
||||
//setup()とloop()で共通して使う値はグローバル変数(関数の外側)で定義しておく
|
||||
int ref = 0;
|
||||
|
||||
void setup() {
|
||||
pinMode(A0, INPUT);
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
Serial.begin(9600);
|
||||
//繋げた導体の状態で初期値が変わるので、それを保存しておく必要がある
|
||||
ref = ADCTouch.read(A0, 100); //(使用するピン番号,平均を取るサンプル数)
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
int val = ADCTouch.read(A0, 100) - ref;
|
||||
if (val > 40) {
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
} else {
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
}
|
||||
|
||||
Serial.println(val);
|
||||
|
||||
delay(40);
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
#include <ADCTouch.h>
|
||||
|
||||
void setup() {
|
||||
pinMode(A0, INPUT);
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
Serial.begin(9600);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
int val = ADCTouch.read(A0, 100);
|
||||
Serial.println(val);
|
||||
delay(40);
|
||||
}
|
@@ -0,0 +1,68 @@
|
||||
#include <ADCTouch.h>
|
||||
|
||||
const int upButton = A0;
|
||||
const int downButton = A1;
|
||||
const int leftButton = A2;
|
||||
const int rightButton = A3;
|
||||
const int mouseButton = A4;
|
||||
int ref_up = 0;
|
||||
int ref_down = 0;
|
||||
int ref_left = 0;
|
||||
int ref_right = 0;
|
||||
int ref_mouse = 0;
|
||||
|
||||
int range = 10; // マウスカーソルの移動幅
|
||||
|
||||
void setup() {
|
||||
randomSeed(analogRead(A5));
|
||||
|
||||
pinMode(upButton, INPUT);
|
||||
pinMode(downButton, INPUT);
|
||||
pinMode(leftButton, INPUT);
|
||||
pinMode(rightButton, INPUT);
|
||||
pinMode(mouseButton, INPUT);
|
||||
|
||||
ref_up = ADCTouch.read(upButton, 100);
|
||||
ref_down = ADCTouch.read(downButton, 100);
|
||||
ref_left = ADCTouch.read(leftButton, 100);
|
||||
ref_right = ADCTouch.read(rightButton, 100);
|
||||
ref_mouse = ADCTouch.read(mouseButton, 100);
|
||||
|
||||
Serial.begin(9600);
|
||||
}
|
||||
|
||||
//マウス移動に関する処理をひとまとめに
|
||||
void moveMouse(int x, int y, int mouse_state) {
|
||||
Serial.print(x);
|
||||
Serial.print(" ");
|
||||
Serial.print(y);
|
||||
Serial.print(" ");
|
||||
Serial.println(mouse_state);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// ボタンの検出
|
||||
int v1 = ADCTouch.read(upButton, 100) - ref_up;
|
||||
int v2 = ADCTouch.read(downButton, 100) - ref_down;
|
||||
int v3 = ADCTouch.read(leftButton, 100) - ref_left;
|
||||
int v4 = ADCTouch.read(rightButton, 100) - ref_right;
|
||||
int v5 = ADCTouch.read(mouseButton, 100) - ref_mouse;
|
||||
//40以上ならクリックしたとみなし、1を、40以下なら0を
|
||||
// A ? B : C;はif (A) { return B;} else {return C;} の略記(三項演算子)
|
||||
int upState = v1 > 40 ? 1 : 0;
|
||||
int downState = v2 > 40 ? 1 : 0;
|
||||
int rightState = v3 > 40 ? 1 : 0;
|
||||
int leftState = v4 > 40 ? 1 : 0;
|
||||
int clickState = v5 > 40 ? 1 : 0;
|
||||
// 移動距離を算出(左右同時押しも考慮)
|
||||
int xDistance = (leftState - rightState) * range + random(-10,10);
|
||||
int yDistance = (upState - downState) * range + random(-10,10);
|
||||
|
||||
//移動もクリックもしてないならシリアル送信は冗長なので、しない
|
||||
// && は AND、!はNOT
|
||||
if (!(xDistance == 0 && yDistance == 0 && clickState == 0)) {
|
||||
moveMouse(xDistance, yDistance, clickState);
|
||||
}
|
||||
|
||||
delay(5);
|
||||
}
|
After Width: | Height: | Size: 317 KiB |
After Width: | Height: | Size: 206 KiB |
After Width: | Height: | Size: 128 KiB |
After Width: | Height: | Size: 511 KiB |
After Width: | Height: | Size: 617 KiB |
After Width: | Height: | Size: 404 KiB |
After Width: | Height: | Size: 420 KiB |
After Width: | Height: | Size: 406 KiB |
After Width: | Height: | Size: 150 KiB |
After Width: | Height: | Size: 368 KiB |
After Width: | Height: | Size: 443 KiB |
After Width: | Height: | Size: 461 KiB |
After Width: | Height: | Size: 605 KiB |
After Width: | Height: | Size: 1.3 MiB |
After Width: | Height: | Size: 659 KiB |
After Width: | Height: | Size: 408 KiB |
After Width: | Height: | Size: 619 KiB |
After Width: | Height: | Size: 227 KiB |
After Width: | Height: | Size: 575 KiB |
After Width: | Height: | Size: 287 KiB |
After Width: | Height: | Size: 276 KiB |
After Width: | Height: | Size: 928 KiB |
After Width: | Height: | Size: 1010 KiB |
After Width: | Height: | Size: 202 KiB |
After Width: | Height: | Size: 234 KiB |
After Width: | Height: | Size: 979 KiB |
After Width: | Height: | Size: 288 KiB |
After Width: | Height: | Size: 409 KiB |
After Width: | Height: | Size: 506 KiB |
After Width: | Height: | Size: 846 KiB |
After Width: | Height: | Size: 955 KiB |
10
content/docs/2023/code-design/7/slides/index.en.md
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: "Code and Design 2023 class 7 Slides"
|
||||
date: 2023-05-26
|
||||
bookHidden: true
|
||||
---
|
||||
|
||||
|
||||
# Slides
|
||||
|
||||
{{< slides_jpg >}}
|
10
content/docs/2023/code-design/7/slides/index.md
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: "コードとデザイン 2023年 第7回 スライド"
|
||||
date: 2023-05-26
|
||||
bookHidden: true
|
||||
---
|
||||
|
||||
|
||||
# スライド
|
||||
|
||||
{{< slides_jpg >}}
|