Skip to content

Commit

Permalink
MakeCodeプロジェクトの初期ファイル
Browse files Browse the repository at this point in the history
  • Loading branch information
azumangadaiou committed Feb 18, 2024
1 parent 4412ebe commit b6f787d
Show file tree
Hide file tree
Showing 11 changed files with 144 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["ms-edu.pxt-vscode-web"]
}
29 changes: 29 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"editor.formatOnType": true,
"files.autoSave": "afterDelay",
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/built/**": true,
"**/node_modules/**": true,
"**/yotta_modules/**": true,
"**/yotta_targets": true,
"**/pxt_modules/**": true,
"**/.pxt/**": true
},
"files.associations": {
"*.blocks": "html",
"*.jres": "json"
},
"search.exclude": {
"**/built": true,
"**/node_modules": true,
"**/yotta_modules": true,
"**/yotta_targets": true,
"**/pxt_modules": true,
"**/.pxt": true
},
"files.exclude": {
"**/pxt_modules": true,
"**/.pxt": true
}
}
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
source 'https://rubygems.org'
gem 'github-pages', group: :jekyll_plugins
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
all: deploy

build:
pxt build

deploy:
pxt deploy

test:
pxt test
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

> このページを開く [https://azumangadaiou.github.io/microbit_onoff/](https://azumangadaiou.github.io/microbit_onoff/)
## 拡張機能として使用

このリポジトリは、MakeCode で **拡張機能** として追加できます。

* [https://makecode.microbit.org/](https://makecode.microbit.org/) を開く
* **新しいプロジェクト** をクリックしてください
* ギアボタンメニューの中にある **拡張機能** をクリックしてください
* **https://github.com/azumangadaiou/microbit_onoff** を検索してインポートします。

## このプロジェクトを編集します

MakeCode でこのリポジトリを編集します。

* [https://makecode.microbit.org/](https://makecode.microbit.org/) を開く
* **読み込む** をクリックし、 **URLから読み込む...** をクリックしてください
* **https://github.com/azumangadaiou/microbit_onoff** を貼り付けてインポートをクリックしてください

#### メタデータ (検索、レンダリングに使用)

* for PXT/microbit
<script src="https://makecode.com/gh-pages-embed.js"></script><script>makeCodeRender("{{ site.makecode.home_url }}", "{{ site.github.owner_name }}/{{ site.github.repository_name }}");</script>
8 changes: 8 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
makecode:
target: microbit
platform: microbit
home_url: https://makecode.microbit.org/
theme: jekyll-theme-slate
include:
- assets
- README.md
1 change: 1 addition & 0 deletions main.blocks
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<xml xmlns="https://developers.google.com/blockly/xml"><variables><variable id="1G[iS1]!g]@0S!(Zzm{B">P0</variable><variable id="*eTM_=kSBvd2QIwA}Js0">P1</variable></variables><block type="pxt-on-start" id="CRXv2u,8DcDCNCX5jgZ[" x="0" y="0"><statement name="HANDLER"><block type="variables_set" id="e8_`h-=hO2Tm,%Js6w5t"><field name="VAR" id="1G[iS1]!g]@0S!(Zzm{B">P0</field><value name="VALUE"><shadow type="math_number" id="|*pZ[*T_kZe733BAienk"><field name="NUM">0</field></shadow></value><next><block type="variables_set" id="9rfGD,otJ);,]^H9[@hU"><field name="VAR" id="*eTM_=kSBvd2QIwA}Js0">P1</field><value name="VALUE"><shadow type="math_number" id="n^j+o0)cd,#fT8)8olFt"><field name="NUM">0</field></shadow></value></block></next></block></statement></block><block type="device_forever" id="%a${*egCBn-F+H9Gg,Ax" x="296" y="36"><statement name="HANDLER"><block type="device_set_digital_pin" id="(^Z6eS^(tga3vwh_E9-{"><field name="name">DigitalPin.P0</field><value name="value"><shadow type="math_number_minmax"><mutation min="0" max="1" label="Value" precision="0"></mutation><field name="SLIDER">1</field></shadow><block type="variables_get" id="hp[@[ne`K.3Ik(A!@m5/"><field name="VAR" id="1G[iS1]!g]@0S!(Zzm{B">P0</field></block></value><next><block type="device_set_digital_pin" id="/%v4=7Xz7aItLuq7S;4D"><field name="name">DigitalPin.P1</field><value name="value"><shadow type="math_number_minmax"><mutation min="0" max="1" label="Value" precision="0"></mutation><field name="SLIDER">0</field></shadow><block type="variables_get" id="yq^(FWK@ju:P^s91wSqJ"><field name="VAR" id="*eTM_=kSBvd2QIwA}Js0">P1</field></block></value><next><block type="controls_if" id="Y#(_!_iP2.B@YzWvJR~h"><mutation else="1"></mutation><value name="IF0"><shadow type="logic_boolean"><field name="BOOL">TRUE</field></shadow><block type="logic_compare" id="h(X/+:G[zLhfp@8goJ@+"><field name="OP">EQ</field><value name="A"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="variables_get" id="Y,`YsJw*f-eg-H,n;iqp"><field name="VAR" id="1G[iS1]!g]@0S!(Zzm{B">P0</field></block></value><value name="B"><shadow type="math_number" id="cEN=X:`?SOJBEw)yx])6"><field name="NUM">0</field></shadow></value></block></value><statement name="DO0"><block type="device_unplot" id="~m99y+}0PA!JCb4Gi_+,"><value name="x"><shadow type="math_number_minmax" id="r/.mQ{tN{?X:/38D#6!v"><mutation min="0" max="4" label="X" precision="1"></mutation><field name="SLIDER">0</field></shadow></value><value name="y"><shadow type="math_number_minmax" id="KgPWr*.a;_)PTpg!]d{N"><mutation min="0" max="4" label="Y" precision="1"></mutation><field name="SLIDER">2</field></shadow></value></block></statement><statement name="ELSE"><block type="device_plot" id="Y^}}qXV-n8ct.C.CipT:"><value name="x"><shadow type="math_number_minmax" id="P{B@GjZ`T.XTdXM#dPfW"><mutation min="0" max="4" label="X" precision="1"></mutation><field name="SLIDER">0</field></shadow></value><value name="y"><shadow type="math_number_minmax" id="/X:w+Kl+!#Q:$r5g0VOI"><mutation min="0" max="4" label="Y" precision="1"></mutation><field name="SLIDER">2</field></shadow></value></block></statement><next><block type="controls_if" id="KNo4B(I_RD*@`|e$ms(X"><mutation else="1"></mutation><value name="IF0"><shadow type="logic_boolean"><field name="BOOL">TRUE</field></shadow><block type="logic_compare" id="%GlbFctzwrE5O8^u2fVP"><field name="OP">EQ</field><value name="A"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="variables_get" id="W-K,H(MnGUK7E1~s}hXL"><field name="VAR" id="*eTM_=kSBvd2QIwA}Js0">P1</field></block></value><value name="B"><shadow type="math_number" id="wr_.)8JOe$j:Ruw]%oNq"><field name="NUM">0</field></shadow></value></block></value><statement name="DO0"><block type="device_unplot" id="nxi86Z4098zsP%,Hnjcv"><value name="x"><shadow type="math_number_minmax" id="0NVV|sGN:$0r~rfwwdX-"><mutation min="0" max="4" label="X" precision="1"></mutation><field name="SLIDER">4</field></shadow></value><value name="y"><shadow type="math_number_minmax" id="uZc|,.O[j0RGu+:SQpzO"><mutation min="0" max="4" label="Y" precision="1"></mutation><field name="SLIDER">2</field></shadow></value></block></statement><statement name="ELSE"><block type="device_plot" id="Yt(r^t|Qr|~.IZy29s8S"><value name="x"><shadow type="math_number_minmax" id="6Zkpm*!^hpFv2zz[UIZ="><mutation min="0" max="4" label="X" precision="1"></mutation><field name="SLIDER">4</field></shadow></value><value name="y"><shadow type="math_number_minmax" id="Ry~W.`UkuyLLAPu,63N("><mutation min="0" max="4" label="Y" precision="1"></mutation><field name="SLIDER">2</field></shadow></value></block></statement></block></next></block></next></block></next></block></statement></block><block type="device_button_event" id="}3{Z6%.U@aO6xY^0`qtE" x="721" y="21"><field name="NAME">Button.B</field><statement name="HANDLER"><block type="controls_if" id="YaPr+|%sUgifa?X%xwek"><mutation else="1"></mutation><value name="IF0"><shadow type="logic_boolean"><field name="BOOL">TRUE</field></shadow><block type="logic_compare" id="_ZS#4Z8]@|`di5t6Zdd/"><field name="OP">EQ</field><value name="A"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="variables_get" id="QKvL#p28C1]=LYr5B|jM"><field name="VAR" id="*eTM_=kSBvd2QIwA}Js0">P1</field></block></value><value name="B"><shadow type="math_number" id="SP`Jsa}wB;FY]_Fw:taa"><field name="NUM">0</field></shadow></value></block></value><statement name="DO0"><block type="variables_set" id="(zERv3FJ8pb5sOqY6:_*"><field name="VAR" id="*eTM_=kSBvd2QIwA}Js0">P1</field><value name="VALUE"><shadow type="math_number" id="+_?so%$+iXfc=!c6wR4z"><field name="NUM">1</field></shadow></value></block></statement><statement name="ELSE"><block type="variables_set" id="1E.283s1FB;DpuH{Mmvp"><field name="VAR" id="*eTM_=kSBvd2QIwA}Js0">P1</field><value name="VALUE"><shadow type="math_number" id="uM2-{(^orwRty5biF;#E"><field name="NUM">0</field></shadow></value></block></statement></block></statement></block><block type="device_button_event" id="K0?]kMp{B=1ss1;VuXTa" x="725" y="352"><field name="NAME">Button.A</field><statement name="HANDLER"><block type="controls_if" id="GG:Uhs]3CmB1s?#H4ES+"><mutation else="1"></mutation><value name="IF0"><shadow type="logic_boolean"><field name="BOOL">TRUE</field></shadow><block type="logic_compare" id="9I4u@#yRik2`:yrKutjA"><field name="OP">EQ</field><value name="A"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="variables_get" id="ys?Q5}XAQ6MrU~MgK)Y*"><field name="VAR" id="1G[iS1]!g]@0S!(Zzm{B">P0</field></block></value><value name="B"><shadow type="math_number" id="N6Qn%=|j{y,SYTbFDEUx"><field name="NUM">0</field></shadow></value></block></value><statement name="DO0"><block type="variables_set" id="-0J1GX+9{VD`l;UJ.B`4"><field name="VAR" id="1G[iS1]!g]@0S!(Zzm{B">P0</field><value name="VALUE"><shadow type="math_number" id="IdRu(nT]{FWk@U*vA9WE"><field name="NUM">1</field></shadow></value></block></statement><statement name="ELSE"><block type="variables_set" id="y`EdXIW}HQ?R~Z63m~bX"><field name="VAR" id="1G[iS1]!g]@0S!(Zzm{B">P0</field><value name="VALUE"><shadow type="math_number" id="w,aP68eT#/J}}VBEm;_P"><field name="NUM">0</field></shadow></value></block></statement></block></statement></block></xml>
32 changes: 32 additions & 0 deletions main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
input.onButtonPressed(Button.A, function () {
if (P0 == 0) {
P0 = 1
} else {
P0 = 0
}
})
input.onButtonPressed(Button.B, function () {
if (P1 == 0) {
P1 = 1
} else {
P1 = 0
}
})
let P1 = 0
let P0 = 0
P0 = 0
P1 = 0
basic.forever(function () {
pins.digitalWritePin(DigitalPin.P0, P0)
pins.digitalWritePin(DigitalPin.P1, P1)
if (P0 == 0) {
led.unplot(0, 2)
} else {
led.plot(0, 2)
}
if (P1 == 0) {
led.unplot(4, 2)
} else {
led.plot(4, 2)
}
})
25 changes: 25 additions & 0 deletions pxt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "ON/OFFだけ",
"description": "",
"dependencies": {
"core": "*",
"radio": "*",
"microphone": "*"
},
"files": [
"main.blocks",
"main.ts",
"README.md"
],
"testFiles": [
"test.ts"
],
"targetVersions": {
"target": "6.0.25",
"targetId": "microbit"
},
"supportedTargets": [
"microbit"
],
"preferredEditor": "blocksprj"
}
1 change: 1 addition & 0 deletions test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// テストはここに来ます。このパッケージが拡張機能として使用されるときにはコンパイルされません。
9 changes: 9 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"target": "ES5",
"noImplicitAny": true,
"outDir": "built",
"rootDir": "."
},
"exclude": ["pxt_modules/**/*test.ts"]
}

0 comments on commit b6f787d

Please sign in to comment.