-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
185 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: MakeCode | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [8.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: npm install | ||
run: | | ||
npm install -g pxt | ||
pxt target microbit | ||
- name: build | ||
run: | | ||
pxt install | ||
pxt build --cloud | ||
env: | ||
CI: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"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 | ||
}, | ||
"files.associations": { | ||
"*.blocks": "html", | ||
"*.jres": "json" | ||
}, | ||
"search.exclude": { | ||
"**/built": true, | ||
"**/node_modules": true, | ||
"**/yotta_modules": true, | ||
"**/yotta_targets": true, | ||
"**/pxt_modules": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
// A task runner that calls the MakeCode (PXT) compiler | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [{ | ||
"label": "pxt deploy", | ||
"type": "shell", | ||
"command": "pxt deploy --local", | ||
"group": "build", | ||
"problemMatcher": [ "$tsc" ] | ||
}, { | ||
"label": "pxt build", | ||
"type": "shell", | ||
"command": "pxt build --local", | ||
"group": "build", | ||
"problemMatcher": [ "$tsc" ] | ||
}, { | ||
"label": "pxt install", | ||
"type": "shell", | ||
"command": "pxt install", | ||
"group": "build", | ||
"problemMatcher": [ "$tsc" ] | ||
}, { | ||
"label": "pxt clean", | ||
"type": "shell", | ||
"command": "pxt clean", | ||
"group": "test", | ||
"problemMatcher": [ "$tsc" ] | ||
}] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
source 'https://rubygems.org' | ||
gem 'github-pages', group: :jekyll_plugins |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
> Open this page at [https://rizal72.github.io/tiltball/](https://rizal72.github.io/tiltball/) | ||
## Use as Extension | ||
|
||
This repository can be added as an **extension** in MakeCode. | ||
|
||
* open [https://makecode.microbit.org/](https://makecode.microbit.org/) | ||
* click on **New Project** | ||
* click on **Extensions** under the gearwheel menu | ||
* search for **https://github.com/rizal72/tiltball** and import | ||
|
||
## Edit this project ![Build status badge](https://github.com/rizal72/tiltball/workflows/MakeCode/badge.svg) | ||
|
||
To edit this repository in MakeCode. | ||
|
||
* open [https://makecode.microbit.org/](https://makecode.microbit.org/) | ||
* click on **Import** then click on **Import URL** | ||
* paste **https://github.com/rizal72/tiltball** and click import | ||
|
||
## Blocks preview | ||
|
||
This image shows the blocks code from the last commit in master. | ||
This image may take a few minutes to refresh. | ||
|
||
![A rendered view of the blocks](https://github.com/rizal72/tiltball/raw/master/.github/makecode/blocks.png) | ||
|
||
#### Metadata (used for search, rendering) | ||
|
||
* 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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<xml xmlns="https://developers.google.com/blockly/xml"><variables><variable id="R0.y*+z1m.R;?;IRjLMQ">ball</variable><variable id="CDH]zRPmfY:LFX7o4n|r">sprite</variable><variable id="iId=gX?H@Rb]7/cb3`YA">a</variable><variable id="{w?lwscaH8ta{6|oF5m6">maxV</variable><variable id="XNYzq`QrPK$*z2F=4a;o">v</variable></variables><block type="pxt-on-start" id="e+`]IMvb[|hakpx$~2h8" x="0" y="0"><statement name="HANDLER"><block type="variables_set" id="Q+`~TH3;vo_*HF3Y=i~k"><field name="VAR" id="R0.y*+z1m.R;?;IRjLMQ">ball</field><value name="VALUE"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="game_create_sprite" id="Q1P)RL(PsH[B^6V%CcOd"><value name="x"><shadow type="math_number" id="XF:[bda~sDtmjfi^rL.["><field name="NUM">2</field></shadow></value><value name="y"><shadow type="math_number" id="R%rXn4M`%p14!4N(=RDA"><field name="NUM">2</field></shadow></value></block></value><next><block type="variables_set" id="BH/+a[e]`|XJN%+K94|c"><field name="VAR" id="iId=gX?H@Rb]7/cb3`YA">a</field><value name="VALUE"><shadow type="math_number" id="D=d#kLktnzYi0nU;Xj?2"><field name="NUM">10</field></shadow></value></block></next></block></statement></block><block type="device_forever" id="6z3lO:/dAv_;Y65HfIu4" x="655" y="187"><statement name="HANDLER"><block type="controls_if" id="XorFA3j,V5!^u)`:IXE5"><value name="IF0"><shadow type="logic_boolean"><field name="BOOL">TRUE</field></shadow><block type="logic_compare" id="_kPINxA~=|]Gxr+#mS%w"><field name="OP">GT</field><value name="A"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="device_acceleration" id="0tjyzMm^vpY`=wT?ZZg3"><field name="NAME">Dimension.Y</field></block></value><value name="B"><shadow type="math_number"><field name="NUM">100</field></shadow><block type="variables_get" id="jX,zvkp)T3Ioy]$H7.P1"><field name="VAR" id="iId=gX?H@Rb]7/cb3`YA">a</field></block></value></block></value><statement name="DO0"><block type="game_sprite_change_xy" id="pf,~;7Dyi5/A^Z,naTDu"><field name="property">LedSpriteProperty.Y</field><value name="sprite"><block type="variables_get" id="**lmICL@w4PM9GM]ONR%"><field name="VAR" id="R0.y*+z1m.R;?;IRjLMQ">ball</field></block></value><value name="value"><shadow type="math_number" id="G}Ld@:0uKq?U!eNBjnE="><field name="NUM">1</field></shadow></value></block></statement><next><block type="controls_if" id="QynmDUwrYBZ6!]#0xp^!"><value name="IF0"><shadow type="logic_boolean"><field name="BOOL">TRUE</field></shadow><block type="logic_compare" id="?A5C[,iyS1G[dwZ]HViC"><field name="OP">LT</field><value name="A"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="device_acceleration" id="J%kY:Uz_}?O|+N_]_wPw"><field name="NAME">Dimension.Y</field></block></value><value name="B"><shadow type="math_number"><field name="NUM">-100</field></shadow><block type="math_arithmetic" id="zFWvFIJ6^7$(LVG%rs?x"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="variables_get" id="?s.{V(d!/dp*ip5B2nz6"><field name="VAR" id="iId=gX?H@Rb]7/cb3`YA">a</field></block></value><value name="B"><shadow type="math_number" id="VrXDr%9[L7#PAXVF`F-?"><field name="NUM">-1</field></shadow></value></block></value></block></value><statement name="DO0"><block type="game_sprite_change_xy" id="?W4*L]s)485,(9%[T5F8"><field name="property">LedSpriteProperty.Y</field><value name="sprite"><block type="variables_get" id="rez?/Uyap+OFk}eQbyev"><field name="VAR" id="R0.y*+z1m.R;?;IRjLMQ">ball</field></block></value><value name="value"><shadow type="math_number" id="f+X*q0vFb@Es*Q@@w4T}"><field name="NUM">-1</field></shadow></value></block></statement><next><block type="device_pause" id="=UKZbYoqIL!,G1pPaIb_"><value name="pause"><shadow type="timePicker"><field name="ms">100</field></shadow><block type="math_arithmetic" id="g}i[2du#HhWA{IsEQ1:O"><field name="OP">DIVIDE</field><value name="A"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="math_arithmetic" id="4MM/gadKL!m~A)gk_c/n"><field name="OP">MINUS</field><value name="A"><shadow type="math_number" id="9Or,Dt(5hJ)q2t;T/p3`"><field name="NUM">1024</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="math_op3" id="|Aj;bA$|0`9XRZoVUy2,"><value name="x"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="device_acceleration" id="H#jx,~fDi;m+AG~XUJ]?"><field name="NAME">Dimension.Y</field></block></value></block></value></block></value><value name="B"><shadow type="math_number" id="m-KIA8}jC^/s*L2bz!tB"><field name="NUM">5</field></shadow></value></block></value></block></next></block></next></block></statement></block><block type="device_forever" id="dD4F^KotDk#t#s~@J_Zw" x="2" y="313"><statement name="HANDLER"><block type="controls_if" id="Q`H1.a0~#^n8D2y^2h|3"><value name="IF0"><shadow type="logic_boolean"><field name="BOOL">TRUE</field></shadow><block type="logic_compare" id="5l{qMS[gCI5djnkvC-sz"><field name="OP">GT</field><value name="A"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="device_acceleration" id=":.H@o%j!TAyLcJXze4l]"><field name="NAME">Dimension.X</field></block></value><value name="B"><shadow type="math_number"><field name="NUM">100</field></shadow><block type="variables_get" id="tXZy4#@Pi,u[(F6:]G3!"><field name="VAR" id="iId=gX?H@Rb]7/cb3`YA">a</field></block></value></block></value><statement name="DO0"><block type="game_sprite_change_xy" id="Jy]}+KBHQ,G,RkWztkdB"><field name="property">LedSpriteProperty.X</field><value name="sprite"><block type="variables_get" id="NQU{S}vTM37-Y{6iHYMs"><field name="VAR" id="R0.y*+z1m.R;?;IRjLMQ">ball</field></block></value><value name="value"><shadow type="math_number" id="Kg2wBcx]h[vrVm{:_TtA"><field name="NUM">1</field></shadow></value></block></statement><next><block type="controls_if" id="_GVcM]VAK^kgi}|K$aj-"><value name="IF0"><shadow type="logic_boolean"><field name="BOOL">TRUE</field></shadow><block type="logic_compare" id="Kt~reS2yGd0*7Ft-rn;s"><field name="OP">LT</field><value name="A"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="device_acceleration" id="D5LbTckgYo/)F/5kxV|9"><field name="NAME">Dimension.X</field></block></value><value name="B"><shadow type="math_number"><field name="NUM">-100</field></shadow><block type="math_arithmetic" id="e/nve$x2C6/eoGUCg(u!"><field name="OP">MULTIPLY</field><value name="A"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="variables_get" id="o1z@QEW,a3mU?D:u{82h"><field name="VAR" id="iId=gX?H@Rb]7/cb3`YA">a</field></block></value><value name="B"><shadow type="math_number" id=")^[jV@_#)Ua|X;-cdZ8X"><field name="NUM">-1</field></shadow></value></block></value></block></value><statement name="DO0"><block type="game_sprite_change_xy" id="?6B;0V1i|wHapLaZS=OP"><field name="property">LedSpriteProperty.X</field><value name="sprite"><block type="variables_get" id="h5:~54;fnE=jJ|qLY,yh"><field name="VAR" id="R0.y*+z1m.R;?;IRjLMQ">ball</field></block></value><value name="value"><shadow type="math_number" id="?5`y@tSDDi~sf:3UK*se"><field name="NUM">-1</field></shadow></value></block></statement><next><block type="device_pause" id=":Qe[@0NBIK2k8s}wyvy/"><value name="pause"><shadow type="timePicker" id="%[9vt.V:t!*EqM3P:+dH"><field name="ms">100</field></shadow></value></block></next></block></next></block></statement></block></xml> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
let ball = game.createSprite(2, 2) | ||
let a = 10 | ||
basic.forever(function () { | ||
if (input.acceleration(Dimension.Y) > a) { | ||
ball.change(LedSpriteProperty.Y, 1) | ||
} | ||
if (input.acceleration(Dimension.Y) < a * -1) { | ||
ball.change(LedSpriteProperty.Y, -1) | ||
} | ||
basic.pause((1024 - Math.abs(input.acceleration(Dimension.Y))) / 5) | ||
}) | ||
basic.forever(function () { | ||
if (input.acceleration(Dimension.X) > a) { | ||
ball.change(LedSpriteProperty.X, 1) | ||
} | ||
if (input.acceleration(Dimension.X) < a * -1) { | ||
ball.change(LedSpriteProperty.X, -1) | ||
} | ||
basic.pause(100) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "TiltBall", | ||
"description": "", | ||
"dependencies": { | ||
"core": "*", | ||
"radio": "*", | ||
"microphone": "*" | ||
}, | ||
"files": [ | ||
"main.blocks", | ||
"main.ts", | ||
"README.md" | ||
], | ||
"testFiles": [ | ||
"test.ts" | ||
], | ||
"supportedTargets": [ | ||
"microbit" | ||
], | ||
"preferredEditor": "blocksprj" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// tests go here; this will not be compiled when this package is used as an extension. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] | ||
} |