Initial files for MakeCode project

This commit is contained in:
H. Saw 2022-10-29 20:33:29 +08:00
parent ba252b0a14
commit 3d08876c33
11 changed files with 149 additions and 0 deletions

23
.vscode/settings.json vendored Normal file
View File

@ -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
}
}

2
Gemfile Normal file
View File

@ -0,0 +1,2 @@
source 'https://rubygems.org'
gem 'github-pages', group: :jekyll_plugins

10
Makefile Normal file
View File

@ -0,0 +1,10 @@
all: deploy
build:
pxt build
deploy:
pxt deploy
test:
pxt test

31
README.md Normal file
View File

@ -0,0 +1,31 @@
> Open this page at [https://buzz-lightsnack-2007.github.io/microbit_simplecounter/](https://buzz-lightsnack-2007.github.io/microbit_simplecounter/)
## 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/buzz-lightsnack-2007/microbit_simplecounter** and import
## Edit this project ![Build status badge](https://github.com/buzz-lightsnack-2007/microbit_simplecounter/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/buzz-lightsnack-2007/microbit_simplecounter** 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/buzz-lightsnack-2007/microbit_simplecounter/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>

8
_config.yml Normal file
View File

@ -0,0 +1,8 @@
makecode:
target: microbit
platform: microbit
home_url: https://makecode.microbit.org/
theme: jekyll-theme-slate
include:
- assets
- README.md

1
main.blocks Normal file
View File

@ -0,0 +1 @@
<xml xmlns="https://developers.google.com/blockly/xml"></xml>

13
main.py Normal file
View File

@ -0,0 +1,13 @@
"""
CounterTracker
simple counter tracker for the Micro:Bit
"""
def startup():
music.ring_tone(Note.C)
return(True)

25
main.ts Normal file
View File

@ -0,0 +1,25 @@
/**
CounterTracker
simple counter tracker for the Micro:Bit
*/
input.onButtonPressed(Button.A, function () {
count += 1;
basic.showNumber(count)
})
input.onButtonPressed(Button.AB, function() {
count = 0;
basic.showNumber(count)
})
function startup(): boolean {
music.ringTone(Note.C)
count = 0;
basic.showNumber(count)
return true
}
let count = 0;
startup()

26
pxt.json Normal file
View File

@ -0,0 +1,26 @@
{
"name": "MicroBit_SimpleCounter",
"description": "",
"dependencies": {
"core": "*",
"radio": "*",
"microphone": "*"
},
"files": [
"main.blocks",
"main.ts",
"README.md",
"main.py"
],
"testFiles": [
"test.ts"
],
"targetVersions": {
"target": "5.0.12",
"targetId": "microbit"
},
"supportedTargets": [
"microbit"
],
"preferredEditor": "tsprj"
}

1
test.ts Normal file
View File

@ -0,0 +1 @@
// tests go here; this will not be compiled when this package is used as an extension.

9
tsconfig.json Normal file
View File

@ -0,0 +1,9 @@
{
"compilerOptions": {
"target": "ES5",
"noImplicitAny": true,
"outDir": "built",
"rootDir": "."
},
"exclude": ["pxt_modules/**/*test.ts"]
}