Compare commits
46 Commits
v2.1.29
...
newtypescr
Author | SHA1 | Date | |
---|---|---|---|
7ca2432652 | |||
5bffab8736 | |||
f53010763a | |||
7e7414ad4e | |||
6183c38253 | |||
64161dea1b | |||
3fa148d35a | |||
8aefd3e6bc | |||
b4a9c98a88 | |||
964daade75 | |||
09b254671d | |||
766708e4ab | |||
85b3fdd281 | |||
c1480cbc8b | |||
ae57052452 | |||
b62cd1ca17 | |||
2a30a2dd76 | |||
3fcd625555 | |||
9392c22424 | |||
0720c3b8f5 | |||
c2d06e3444 | |||
2d5582dd6a | |||
0bad95322b | |||
dd63007fe7 | |||
c2314827c7 | |||
25475acd0d | |||
72b9716721 | |||
12dc012887 | |||
1891d440e1 | |||
45411fbfcd | |||
c639609ce5 | |||
9655b6c64c | |||
1a5555ed52 | |||
e5adf2029e | |||
dcea457cb5 | |||
37a531880b | |||
f60daf0e68 | |||
224a028a61 | |||
f6388ae7ab | |||
08ce23df9f | |||
c306db5478 | |||
a8d2466da6 | |||
7bc2352d38 | |||
c92bd90bd0 | |||
039537b84c | |||
457b0e1c5b |
35
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
Add screenshots to help explain your problem. You can copy paste the screenshot in the github report. The .gif screen recording is very useful as well.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- OS: [e.g. iOS]
|
||||
- Browser [e.g. chrome, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Smartphone (please complete the following information):**
|
||||
- Device: [e.g. iPhone6]
|
||||
- OS: [e.g. iOS8.1]
|
||||
- Browser [e.g. stock browser, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
17
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
75
.github/lock.yml
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
# Configuration for Lock Threads - https://github.com/dessant/lock-threads
|
||||
|
||||
|
||||
|
||||
# Number of days of inactivity before a closed issue or pull request is locked
|
||||
|
||||
daysUntilLock: 365
|
||||
|
||||
|
||||
|
||||
# Skip issues and pull requests created before a given timestamp. Timestamp must
|
||||
|
||||
# follow ISO 8601 (`YYYY-MM-DD`). Set to `false` to disable
|
||||
|
||||
skipCreatedBefore: false
|
||||
|
||||
|
||||
|
||||
# Issues and pull requests with these labels will be ignored. Set to `[]` to disable
|
||||
|
||||
exemptLabels: []
|
||||
|
||||
|
||||
|
||||
# Label to add before locking, such as `outdated`. Set to `false` to disable
|
||||
|
||||
lockLabel: false
|
||||
|
||||
|
||||
|
||||
# Comment to post before locking. Set to `false` to disable
|
||||
|
||||
lockComment: >
|
||||
|
||||
This thread has been automatically locked since there has not been
|
||||
|
||||
any recent activity after it was closed. Please open a new issue for
|
||||
|
||||
related bugs.
|
||||
|
||||
|
||||
|
||||
# Assign `resolved` as the reason for locking. Set to `false` to disable
|
||||
|
||||
setLockReason: true
|
||||
|
||||
|
||||
|
||||
# Limit to only `issues` or `pulls`
|
||||
|
||||
# only: issues
|
||||
|
||||
|
||||
|
||||
# Optionally, specify configuration settings just for `issues` or `pulls`
|
||||
|
||||
# issues:
|
||||
|
||||
# exemptLabels:
|
||||
|
||||
# - help-wanted
|
||||
|
||||
# lockLabel: outdated
|
||||
|
||||
|
||||
|
||||
# pulls:
|
||||
|
||||
# daysUntilLock: 30
|
||||
|
||||
|
||||
|
||||
# Repository to extend settings from
|
||||
|
||||
# _extends: repo
|
31
.github/workflows/pxt-buildpr.yml
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
name: pxt-buildpr
|
||||
|
||||
on: [pull_request]
|
||||
|
||||
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: |
|
||||
sudo apt-get install xvfb
|
||||
sudo npm install -g pxt
|
||||
npm install
|
||||
- name: pxt ci
|
||||
run: |
|
||||
pxt ci
|
||||
env:
|
||||
CHROME_BIN: chromium-browser
|
||||
DISPLAY: :99.0
|
||||
CI: true
|
39
.github/workflows/pxt-buildtarget.yml
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
name: pxt-buildtarget
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
create:
|
||||
|
||||
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: |
|
||||
sudo apt-get install xvfb
|
||||
sudo npm install -g pxt
|
||||
npm install
|
||||
- name: pxt ci
|
||||
run: |
|
||||
pxt ci
|
||||
env:
|
||||
CROWDIN_KEY: ${{ secrets.CROWDIN_KEY }}
|
||||
PXT_ACCESS_TOKEN: ${{ secrets.PXT_ACCESS_TOKEN }}
|
||||
PXT_RELEASE_REPO: ${{ secrets.PXT_RELEASE_REPO }}
|
||||
NPM_ACCESS_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
|
||||
CHROME_BIN: chromium-browser
|
||||
DISPLAY: :99.0
|
||||
CI: true
|
6
.gitignore
vendored
@ -15,8 +15,10 @@ clients/win10/app/bld
|
||||
clients/win10/*.opendb
|
||||
clients/**/bin/**
|
||||
clients/**/obj/**
|
||||
clients/electron/projects
|
||||
electron-out
|
||||
hexcache
|
||||
build
|
||||
crowdinstats.csv
|
||||
|
||||
*.user
|
||||
*.sw?
|
||||
@ -31,4 +33,4 @@ hexcache
|
||||
*.iml
|
||||
.vscode/.BROWSE.VC.DB-shm
|
||||
.vscode/.BROWSE.VC.DB-wal
|
||||
package-lock.json
|
||||
package-lock.json
|
46
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch",
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"program": "${workspaceRoot}/../pxt/built/pxt.js",
|
||||
"stopOnEntry": false,
|
||||
"args": ["serve"],
|
||||
"cwd": "${workspaceRoot}",
|
||||
"preLaunchTask": null,
|
||||
"runtimeExecutable": null,
|
||||
"runtimeArgs": [
|
||||
"--nolazy"
|
||||
],
|
||||
"env": {
|
||||
"NODE_ENV": "development"
|
||||
},
|
||||
"console": "internalConsole",
|
||||
"sourceMaps": false,
|
||||
"outDir": null
|
||||
},
|
||||
{
|
||||
"name": "Attach",
|
||||
"type": "node",
|
||||
"request": "attach",
|
||||
"port": 5858,
|
||||
"address": "localhost",
|
||||
"restart": false,
|
||||
"sourceMaps": false,
|
||||
"outDir": null,
|
||||
"localRoot": "${workspaceRoot}",
|
||||
"remoteRoot": null
|
||||
},
|
||||
{
|
||||
"name": "Attach to Process",
|
||||
"type": "node",
|
||||
"request": "attach",
|
||||
"processId": "${command.PickProcess}",
|
||||
"port": 5858,
|
||||
"sourceMaps": false,
|
||||
"outDir": null
|
||||
}
|
||||
]
|
||||
}
|
2
.vscode/settings.json
vendored
@ -1,6 +1,6 @@
|
||||
// Place your settings in this file to overwrite default and user settings.
|
||||
{
|
||||
"file.autoSave": "afterDelay",
|
||||
"files.autoSave": "afterDelay",
|
||||
"files.watcherExclude": {
|
||||
"**/.git/objects/**": true,
|
||||
"**/built/**": true,
|
||||
|
@ -1,7 +1,8 @@
|
||||
# Calliope target for Microsoft MakeCode [](https://travis-ci.org/microsoft/pxt-calliope)
|
||||
# Calliope target for Microsoft MakeCode
|
||||
|
||||
This editor is hosted at https://makecode.calliope.cc.
|
||||
|
||||
* Got a question? Try the forum at https://forum.calliope.cc/
|
||||
|
||||
### BUILD COMMENTS
|
||||
|
||||
|
@ -10,8 +10,8 @@ Here are some cool tutorials to get you started with your @boardname@!
|
||||
"name": "Get Ready",
|
||||
"url":"/calliope/firststeps/firstSteps",
|
||||
"description": "Find out how to start working with the Calliope mini",
|
||||
"imageUrl": "/docs/calliope/firststeps/connecting.jpg",
|
||||
"largeImageUrl": "/docs/calliope/firststeps/firstSteps.jpg",
|
||||
"imageUrl": "/calliope/firststeps/connecting.jpg",
|
||||
"largeImageUrl": "/calliope/firststeps/firstSteps.jpg",
|
||||
"cardType": "tutorial",
|
||||
"label": "Never seen a mini? Start Here!",
|
||||
"labelClass": "green small ribbon"
|
||||
@ -20,8 +20,8 @@ Here are some cool tutorials to get you started with your @boardname@!
|
||||
"name": "The 5x5 LED matrix",
|
||||
"url":"/calliope/firststeps/5x5LED",
|
||||
"description": "Learn how to create and show images, numbers or letters on the LED matrix",
|
||||
"imageUrl": "/docs/calliope/firststeps/5x5LED.jpg",
|
||||
"largeImageUrl": "/docs/calliope/firststeps/5x5LED_L.jpg",
|
||||
"imageUrl": "/calliope/firststeps/5x5LED.jpg",
|
||||
"largeImageUrl": "/calliope/firststeps/5x5LED_L.jpg",
|
||||
"cardType": "tutorial",
|
||||
"label": "New? Start Here!",
|
||||
"labelClass": "yellow small ribbon"
|
||||
@ -30,8 +30,8 @@ Here are some cool tutorials to get you started with your @boardname@!
|
||||
"name": "Radio",
|
||||
"url":"/calliope/firststeps/Radio",
|
||||
"description": "Find out how to use the radion function and how to send messages from one Calliope mini to another one",
|
||||
"imageUrl": "/docs/calliope/firststeps/Radio.jpg",
|
||||
"largeImageUrl": "/docs/calliope/firststeps/Radio_L.jpg",
|
||||
"imageUrl": "/calliope/firststeps/Radio.jpg",
|
||||
"largeImageUrl": "/calliope/firststeps/Radio_L.jpg",
|
||||
"cardType": "tutorial",
|
||||
"label": "",
|
||||
"labelClass": "orange small ribbon"
|
||||
@ -40,8 +40,8 @@ Here are some cool tutorials to get you started with your @boardname@!
|
||||
"name": "Loops",
|
||||
"url":"/calliope/firststeps/Loops",
|
||||
"description": "Loops are important to be able to execute program instructions multiple times",
|
||||
"imageUrl": "/docs/calliope/firststeps/Loops.jpg",
|
||||
"largeImageUrl": "/docs/calliope/firststeps/Loops_L.jpg",
|
||||
"imageUrl": "/calliope/firststeps/Loops.jpg",
|
||||
"largeImageUrl": "/calliope/firststeps/Loops_L.jpg",
|
||||
"cardType": "tutorial",
|
||||
"label": "",
|
||||
"labelClass": "green small ribbon"
|
||||
@ -50,8 +50,8 @@ Here are some cool tutorials to get you started with your @boardname@!
|
||||
"name": "Mathematics",
|
||||
"url":"/calliope/firststeps/Mathematics",
|
||||
"description": "The Calliope mini can become your little math helper",
|
||||
"imageUrl": "/docs/calliope/firststeps/Mathematics.jpg",
|
||||
"largeImageUrl": "/docs/calliope/firststeps/Mathematics_L.jpg",
|
||||
"imageUrl": "/calliope/firststeps/Mathematics.jpg",
|
||||
"largeImageUrl": "/calliope/firststeps/Mathematics_L.jpg",
|
||||
"cardType": "tutorial",
|
||||
"label": "",
|
||||
"labelClass": "green small ribbon"
|
||||
@ -60,8 +60,8 @@ Here are some cool tutorials to get you started with your @boardname@!
|
||||
"name": "Inputs",
|
||||
"url":"/calliope/firststeps/Inputs",
|
||||
"description": "Use conditions for different actions",
|
||||
"imageUrl": "/docs/calliope/firststeps/Inputs.jpg",
|
||||
"largeImageUrl": "/docs/calliope/firststeps/Inputs_L.jpg",
|
||||
"imageUrl": "/calliope/firststeps/Inputs.jpg",
|
||||
"largeImageUrl": "/calliope/firststeps/Inputs_L.jpg",
|
||||
"cardType": "tutorial",
|
||||
"label": "",
|
||||
"labelClass": "green small ribbon"
|
||||
@ -70,8 +70,8 @@ Here are some cool tutorials to get you started with your @boardname@!
|
||||
"name": "Sensors",
|
||||
"url":"/calliope/firststeps/Sensors",
|
||||
"description": "Measure temperature, light and orientation",
|
||||
"imageUrl": "/docs/calliope/firststeps/Sensors.jpg",
|
||||
"largeImageUrl": "/docs/calliope/firststeps/Sensors_L.jpg",
|
||||
"imageUrl": "/calliope/firststeps/Sensors.jpg",
|
||||
"largeImageUrl": "/calliope/firststeps/Sensors_L.jpg",
|
||||
"cardType": "tutorial",
|
||||
"label": "",
|
||||
"labelClass": "green small ribbon"
|
||||
@ -80,8 +80,8 @@ Here are some cool tutorials to get you started with your @boardname@!
|
||||
"name": "Output",
|
||||
"url":"/calliope/firststeps/Output",
|
||||
"description": "Audio, light and motion",
|
||||
"imageUrl": "/docs/calliope/firststeps/Output.jpg",
|
||||
"largeImageUrl": "/docs/calliope/firststeps/Output_L.jpg",
|
||||
"imageUrl": "/calliope/firststeps/Output.jpg",
|
||||
"largeImageUrl": "/calliope/firststeps/Output_L.jpg",
|
||||
"cardType": "tutorial",
|
||||
"label": "",
|
||||
"labelClass": "green small ribbon"
|
||||
@ -90,8 +90,8 @@ Here are some cool tutorials to get you started with your @boardname@!
|
||||
"name": "Decisions",
|
||||
"url":"/calliope/firststeps/Decisions",
|
||||
"description": "If..., then it happens... or it happens...",
|
||||
"imageUrl": "/docs/calliope/firststeps/Decisions.jpg",
|
||||
"largeImageUrl": "/docs/calliope/firststeps/Decisions_L.jpg",
|
||||
"imageUrl": "/calliope/firststeps/Decisions.jpg",
|
||||
"largeImageUrl": "/calliope/firststeps/Decisions_L.jpg",
|
||||
"cardType": "tutorial",
|
||||
"label": "",
|
||||
"labelClass": "green small ribbon"
|
||||
@ -100,8 +100,8 @@ Here are some cool tutorials to get you started with your @boardname@!
|
||||
"name": "Variables",
|
||||
"url":"/calliope/firststeps/Variables",
|
||||
"description": "A variable is not a static value, it’s what you determine it to be.",
|
||||
"imageUrl": "/docs/calliope/firststeps/Variables.jpg",
|
||||
"largeImageUrl": "/docs/calliope/firststeps/Variables_L.jpg",
|
||||
"imageUrl": "/calliope/firststeps/Variables.jpg",
|
||||
"largeImageUrl": "/calliope/firststeps/Variables_L.jpg",
|
||||
"cardType": "tutorial",
|
||||
"label": "",
|
||||
"labelClass": "green small ribbon"
|
||||
|
@ -14,7 +14,7 @@ For example drag and drop some blocks and try your program on the Simulator with
|
||||
|
||||
Click the Download button in the editor. This will download a 'hex' file, which is a compact format of your program that your mini can read. Once the file has been downloaded, just copy it to your Calliope mini just like copying a file to a USB stick.
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
## Introduction @unplugged
|
||||
@ -32,7 +32,7 @@ Be careful to insure that the ridge on the plug is facing upwards.
|
||||
|
||||
If the plug slides easily into the socket then you are attaching it correctly. Otherwise, turn the plug round and re-insert it into the socket. Slide it to "on“ and your Calliope mini is powered by the batteries.
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
## Introduction @unplugged
|
||||
|
@ -10,7 +10,7 @@ Here are some cool tutorials to get you started with your @boardname@!
|
||||
"name": "Shop",
|
||||
"url":"https://shop.calliope.cc",
|
||||
"description": "You can get the mini at the official calliope store.",
|
||||
"imageUrl": "/docs/calliope/links/thumbnail_shop.gif",
|
||||
"imageUrl": "/calliope/links/thumbnail_shop.gif",
|
||||
"largeImageUrl": "",
|
||||
"label": "",
|
||||
"buttonLabel": "Open Calliope Shop",
|
||||
@ -19,7 +19,7 @@ Here are some cool tutorials to get you started with your @boardname@!
|
||||
"name": "Projects",
|
||||
"url":"https://calliope.cc/en/projekte",
|
||||
"description": "A collection of calliope mini projects",
|
||||
"imageUrl": "/docs/calliope/links/thumbnail_projects.gif",
|
||||
"imageUrl": "/calliope/links/thumbnail_projects.gif",
|
||||
"largeImageUrl": "",
|
||||
"label": "",
|
||||
"buttonLabel": "View Projects",
|
||||
@ -28,7 +28,7 @@ Here are some cool tutorials to get you started with your @boardname@!
|
||||
"name": "Teaching materials",
|
||||
"url":"https://calliope.cc/schulen/schulmaterial",
|
||||
"description": "",
|
||||
"imageUrl": "/docs/calliope/links/thumbnail_didactic_material.gif",
|
||||
"imageUrl": "/calliope/links/thumbnail_didactic_material.gif",
|
||||
"largeImageUrl": "",
|
||||
"label": "",
|
||||
"buttonLabel": "View",
|
||||
@ -37,7 +37,7 @@ Here are some cool tutorials to get you started with your @boardname@!
|
||||
"name": "Forum",
|
||||
"url":"https://forum.calliope.cc",
|
||||
"description": "Be a part of our comunity",
|
||||
"imageUrl": "/docs/calliope/links/thumbnail_community.gif",
|
||||
"imageUrl": "/calliope/links/thumbnail_community.gif",
|
||||
"largeImageUrl": "",
|
||||
"label": "",
|
||||
"buttonLabel": "Open Forum",
|
||||
|
@ -9,7 +9,7 @@ Here are some cool tutorials to get you started with your @boardname@!
|
||||
"name": "Flashing Heart",
|
||||
"url":"/projects/flashing-heart",
|
||||
"description": "Make an animated flashing heart.",
|
||||
"imageUrl": "/docs/calliope/tutorials/01_flashing_heart.gif",
|
||||
"imageUrl": "/calliope/tutorials/01_flashing_heart.gif",
|
||||
"largeImageUrl": "",
|
||||
"cardType": "tutorial",
|
||||
"label": "",
|
||||
@ -17,57 +17,57 @@ Here are some cool tutorials to get you started with your @boardname@!
|
||||
}, {
|
||||
"name": "Name Tag",
|
||||
"description": "Scroll your name on the screen",
|
||||
"imageUrl": "/docs/calliope/tutorials/02_nametag.gif",
|
||||
"imageUrl": "/calliope/tutorials/02_nametag.gif",
|
||||
"url": "/projects/name-tag",
|
||||
"cardType": "tutorial"
|
||||
}, {
|
||||
"name": "Smiley Buttons",
|
||||
"url":"/projects/smiley-buttons",
|
||||
"description": "Show different smiley images by pressing the buttons.",
|
||||
"imageUrl": "/docs/calliope/tutorials/03_smiley_button.gif",
|
||||
"imageUrl": "/calliope/tutorials/03_smiley_button.gif",
|
||||
"largeImageUrl": "",
|
||||
"cardType": "tutorial"
|
||||
}, {
|
||||
"name": "Dice",
|
||||
"url":"/projects/dice",
|
||||
"description": "Shake the dice and see what number comes up!",
|
||||
"imageUrl": "/docs/calliope/tutorials/04_dice.gif",
|
||||
"imageUrl": "/calliope/tutorials/04_dice.gif",
|
||||
"cardType": "tutorial"
|
||||
}, {
|
||||
"name": "Love Meter",
|
||||
"url":"/projects/love-meter",
|
||||
"description": "The @boardname@ is feeling the love, see how much!",
|
||||
"imageUrl":"/docs/calliope/tutorials/05_love_meter.gif",
|
||||
"imageUrl":"/calliope/tutorials/05_love_meter.gif",
|
||||
"cardType": "tutorial"
|
||||
}, {
|
||||
"name": "Mini Chat",
|
||||
"url":"/projects/mini-chat",
|
||||
"description": "Build your own social network made of minis.",
|
||||
"imageUrl": "/docs/calliope/tutorials/06_mini_chat.gif",
|
||||
"imageUrl": "/calliope/tutorials/06_mini_chat.gif",
|
||||
"cardType": "tutorial"
|
||||
}, {
|
||||
"name": "Rock Paper Scissors",
|
||||
"url":"/projects/rock-paper-scissors",
|
||||
"description": "Make the Rock-Paper-Scissors game on your @boardname@ and challenge your friends.",
|
||||
"imageUrl":"/docs/calliope/tutorials/07_stone_paper_scissors.gif",
|
||||
"imageUrl":"/calliope/tutorials/07_stone_paper_scissors.gif",
|
||||
"cardType": "tutorial"
|
||||
}, {
|
||||
"name": "Coin Flipper",
|
||||
"url":"/projects/coin-flipper",
|
||||
"description": "Guess the coin toss and see if you're lucky.",
|
||||
"imageUrl": "/docs/calliope/tutorials/08_coin_flipper.gif",
|
||||
"imageUrl": "/calliope/tutorials/08_coin_flipper.gif",
|
||||
"cardType": "tutorial"
|
||||
}, {
|
||||
"name": "Snap the dot",
|
||||
"url": "/projects/snap-the-dot",
|
||||
"description": "Use the game blocks to create a skill game",
|
||||
"imageUrl": "/docs/calliope/tutorials/09_snap_the_dot.gif",
|
||||
"imageUrl": "/calliope/tutorials/09_snap_the_dot.gif",
|
||||
"cardType": "tutorial"
|
||||
}, {
|
||||
"name": "Multi Dice",
|
||||
"url": "/projects/multi-dice",
|
||||
"description": "Compete with multiple dices",
|
||||
"imageUrl": "/docs/calliope/tutorials/10_multi_dice.gif",
|
||||
"imageUrl": "/calliope/tutorials/10_multi_dice.gif",
|
||||
"cardType": "tutorial"
|
||||
}
|
||||
]
|
||||
|
@ -50,10 +50,8 @@ This method of filling coordinate points, counting them, and using the differenc
|
||||
## Monte Carlo approximation of _pi_
|
||||
|
||||
```blocks
|
||||
let pir = 0
|
||||
let pid = 0
|
||||
let pi = 0
|
||||
let y = 0
|
||||
let pin = 0
|
||||
let x = 0
|
||||
let r2 = 0
|
||||
let r = 0
|
||||
@ -87,10 +85,7 @@ basic.forever(() => {
|
||||
// r * r * pi => inside / n ~= (r*r*pi) / (4*r*r) ~=
|
||||
// pi / 4 pi = inside / n * 4
|
||||
//
|
||||
pin = inside * 4
|
||||
// only integer arithmetic here...
|
||||
pid = pin / n
|
||||
pir = pin % n
|
||||
pi = (inside * 4) / n
|
||||
// show results
|
||||
basic.showLeds(`
|
||||
# # # # #
|
||||
@ -99,6 +94,6 @@ basic.forever(() => {
|
||||
. # . # .
|
||||
. # . . #
|
||||
`)
|
||||
basic.showString(" " + pid + "." + pir)
|
||||
basic.showString(" " + pi)
|
||||
})
|
||||
```
|
4
docs/extensions.md
Normal file
@ -0,0 +1,4 @@
|
||||
# @extends
|
||||
|
||||
|
||||
|
@ -5,18 +5,18 @@
|
||||
{
|
||||
"name": "First Steps",
|
||||
"url": "/calliope/firststeps",
|
||||
"imageUrl": "/docs/calliope/firststeps/connecting.jpg",
|
||||
"largeImageUrl": "/docs/calliope/firststeps/firstSteps.jpg"
|
||||
"imageUrl": "/calliope/firststeps/connecting.jpg",
|
||||
"largeImageUrl": "/calliope/firststeps/firstSteps.jpg"
|
||||
},
|
||||
{
|
||||
"name": "Turorials",
|
||||
"name": "Tutorials",
|
||||
"url": "/calliope/tutorials",
|
||||
"imageUrl": "/docs/calliope/tutorials/01_flashing_heart.gif"
|
||||
"imageUrl": "/calliope/tutorials/01_flashing_heart.gif"
|
||||
},
|
||||
{
|
||||
"name": "Calliope Links",
|
||||
"url": "/calliope/links",
|
||||
"imageUrl": "/docs/calliope/links/thumbnail_shop.gif"
|
||||
"imageUrl": "/calliope/links/thumbnail_shop.gif"
|
||||
}
|
||||
]
|
||||
```
|
||||
@ -24,6 +24,6 @@
|
||||
## See Also
|
||||
|
||||
[First Steps](/calliope/firststeps),
|
||||
[Turorials](/calliope/tutorials),
|
||||
[Tutorials](/calliope/tutorials),
|
||||
[Calliope Links](/calliope/links)
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
* [Output](/calliope/firststeps/Output)
|
||||
* [Decisions](/calliope/firststeps/Decisions)
|
||||
* [Variables](/calliope/firststeps/Variables)
|
||||
* [Turorials](/calliope/tutorials)
|
||||
* [Tutorials](/calliope/tutorials)
|
||||
* [Flashing Heart](/projects/flashing-heart)
|
||||
* [Name Tag](/projects/name-tag)
|
||||
* [Smiley Buttons](/projects/smiley-buttons)
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
Let's create a coin flipping program to simulate a real coin toss. We'll use icon images to represent a ``heads`` or ``tails`` result.
|
||||
|
||||

|
||||

|
||||
|
||||
## Step 1
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
Let's turn the @boardname@ into a dice!
|
||||
(Want to learn how the accelerometer works? [Watch this video](https://youtu.be/byngcwjO51U)).
|
||||
|
||||

|
||||

|
||||
|
||||
## Step 1 @fullscreen
|
||||
|
||||
|
@ -6,13 +6,13 @@ Learn how to use the LEDs and make a flashing heart!
|
||||
(Want to learn how lights work? [Watch this video](https://youtu.be/qqBmvHD5bCw)).
|
||||
|
||||
|
||||

|
||||

|
||||
|
||||
## Step 1 @fullscreen
|
||||
|
||||
Place the ``||basic:show leds||`` block in the ``||basic:forever||`` block and draw a heart.
|
||||
|
||||

|
||||

|
||||
|
||||
## Step 2 @fullscreen
|
||||
|
||||
@ -39,7 +39,7 @@ basic.forever(function() {
|
||||
|
||||
Look at the virtual @boardname@, you should see the heart and your drawing blink on the screen.
|
||||
|
||||

|
||||

|
||||
|
||||
## Step 4 @fullscreen
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
Make a love meter, how sweet! The @boardname@ is feeling the love, then sometimes not so much!
|
||||
Tell everyone who you are. Show you name on the LEDs.
|
||||
|
||||

|
||||

|
||||
|
||||
## Step 1
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
## Introduction @unplugged
|
||||
|
||||

|
||||

|
||||
|
||||
Use the **radio** to send and receive messages with other @boardname@.
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
## Introduction @unplugged
|
||||
|
||||

|
||||

|
||||
|
||||
Build a multi-player dice game using the **radio**. The **radio** blocks let you send wireless messages between a @boardname@ and another @boardname@.
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
Tell everyone who you are. Show you name on the LEDs.
|
||||
|
||||

|
||||

|
||||
|
||||
## Step 1 @fullscreen
|
||||
|
||||
@ -20,7 +20,7 @@ basic.forever(() => {
|
||||
|
||||
Look at the simulator and make sure it shows your name on the screen.
|
||||
|
||||

|
||||

|
||||
|
||||
## Step 3 @fullscreen
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
## Introduction @unplugged
|
||||
|
||||

|
||||

|
||||
|
||||
Use the accelerometer and the screen to build a **Rock Paper Scissors** game that you can play with your friends!
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
Code the buttons on the @boardname@ to show that it's happy or sad.
|
||||
(Want to learn how the buttons works? [Watch this video](https://youtu.be/t_Qujjd_38o)).
|
||||
|
||||

|
||||

|
||||
|
||||
## Step 1 @fullscreen
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
## Introduction @unplugged
|
||||
|
||||

|
||||

|
||||
|
||||
Snap the dot is a game of skill where the player has to press **A** exactly when the dot reaches the center of the screen.
|
||||
|
||||
|
@ -9,7 +9,7 @@ basic.showIcon(IconNames.Heart)
|
||||
## Parameters
|
||||
|
||||
* ``icon``, the identifier of the icon to display
|
||||
* ``interval`` (optional), the time to display in milliseconds. default is 400.
|
||||
* ``interval`` (optional), the time to display in milliseconds. default is 600.
|
||||
|
||||
## Example
|
||||
|
||||
@ -21,6 +21,38 @@ basic.pause(1000)
|
||||
basic.showIcon(IconNames.Sad)
|
||||
```
|
||||
|
||||
## Beating Heart
|
||||
|
||||
You can create a beating heart by using the forever block as follows:
|
||||
|
||||
```blocks
|
||||
basic.forever(function () {
|
||||
basic.showIcon(IconNames.Heart)
|
||||
basic.showIcon(IconNames.SmallHeart)
|
||||
})
|
||||
```
|
||||
|
||||
## Fast Beating Heart
|
||||
|
||||
You could slow down the previous animation by inserting a pause block:
|
||||
|
||||
```block
|
||||
basic.pause(1000)
|
||||
```
|
||||
|
||||
...but how would you speed it up?
|
||||
|
||||
You can change the default pause value, which is set in the ``interval`` parameter, to be smaller than `600` by changing it in the JavaScript editor.
|
||||
|
||||
This JavaScript code creates a crazy fast heart beat! Did you know that a hamster's heart beats at a rate this fast?
|
||||
|
||||
```typescript
|
||||
basic.forever(function () {
|
||||
basic.showIcon(IconNames.Heart, 60)
|
||||
basic.showIcon(IconNames.SmallHeart, 60)
|
||||
})
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
[showLeds](/reference/basic/show-leds)
|
||||
[showLeds](/reference/basic/show-leds)
|
||||
|
@ -30,4 +30,4 @@ input.onButtonPressed(Button.AB, () => {
|
||||
|
||||
## See also
|
||||
|
||||
[compassHeading](/reference/input/compass-heading)
|
||||
[compass heading](/reference/input/compass-heading)
|
||||
|
@ -56,10 +56,11 @@ basic.forever(() => {
|
||||
|
||||
## Calibration
|
||||
|
||||
Every time you start to use the compass (for example, if you have just
|
||||
turned the @boardname@ on), the @boardname@ will start to [calibrateCompass](/reference/input/calibrate-compass)
|
||||
(adjust itself). It will ask you to draw a circle by tilting the
|
||||
@boardname@.
|
||||
Every time you start to use the compass (for example, if you have just turned the @boardname@ on),
|
||||
the @boardname@ will start a [calibrate compass](/reference/input/calibrate-compass)
|
||||
(adjust itself).
|
||||
The [calibration step](https://support.microbit.org/support/solutions/articles/19000008874-calibrating-the-micro-bit-compass)
|
||||
will ask you to draw a fill pattern on the screen by tilting the @boardname@.
|
||||
|
||||
If you are calibrating or using the compass near metal, it might
|
||||
confuse the @boardname@.
|
||||
@ -78,4 +79,4 @@ input.onButtonPressed(Button.AB, () => {
|
||||
|
||||
## See also
|
||||
|
||||
[acceleration](/reference/input/acceleration), [calibrateCompass](/reference/input/calibrate-compass)
|
||||
[acceleration](/reference/input/acceleration), [calibrate compass](/reference/input/calibrate-compass)
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Magnetic Force
|
||||
|
||||
Find the amount of magnetic force (the strength of a magnet) in the direction you say.
|
||||
Find the amount of magnetic force (the strength of a magnet) in one of the three directions.
|
||||
|
||||
```sig
|
||||
input.magneticForce(Dimension.X);
|
||||
@ -10,12 +10,14 @@ input.magneticForce(Dimension.X);
|
||||
|
||||
The @boardname@ measures magnetic force with **microteslas**.
|
||||
|
||||
## ~
|
||||
You are asked to [calibrate](https://support.microbit.org/support/solutions/articles/19000008874-calibrating-the-micro-bit-compass) the compass the first time run a program
|
||||
that uses the compass.
|
||||
|
||||
## ~
|
||||
|
||||
## Parameters
|
||||
|
||||
* ``dimension`` means which direction the @boardname@ should measure
|
||||
* **dimension**: this is the direction the @boardname@ should measure
|
||||
magnetic force in: either `Dimension.X` (the left-right direction),
|
||||
`Dimension.Y` (the forward/backward direction), or `Dimension.Z`
|
||||
(the up/down direction)
|
||||
@ -24,16 +26,14 @@ The @boardname@ measures magnetic force with **microteslas**.
|
||||
|
||||
* a [number](/types/number) of microteslas that means the strength of the magnet
|
||||
|
||||
## Example: metal detector
|
||||
## Example
|
||||
|
||||
This program makes the center LED of the @boardname@ get brighter when
|
||||
the magnetic force is stronger, and dimmer when it is weaker.
|
||||
Create a metal detector my measuring the strength of magnetic force in the `X` direction.
|
||||
Display a bar graph to show the current level of magnetic force measured by the magnetometer.
|
||||
|
||||
```blocks
|
||||
led.plot(2, 2)
|
||||
basic.forever(() => {
|
||||
let f = input.magneticForce(Dimension.X)
|
||||
led.setBrightness(f / 2000)
|
||||
basic.forever(function() {
|
||||
led.plotBarGraph(input.magneticForce(Dimension.X) / 2000, 0)
|
||||
})
|
||||
```
|
||||
|
||||
|
BIN
docs/static/hero.jpg
vendored
Normal file
After Width: | Height: | Size: 243 KiB |
1
docs/static/icons/blocks.svg
vendored
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1000" height="1000" viewBox="0 0 1000 1000"><path class="st1" d="m219.11872 941.69081 577.03056 0c22.8432 0 41.38224-18.53952 41.38224-41.49264l0-204.70272c-7.39392-24.82944-28.58112-27.14688-48.44448-8.27664-1.7664 0-21.62928 24.38784-67.31472 24.38784-54.51408-1.656-98.98608-41.93376-107.26224-94.57152l-0.552 0c-0.432-3.864-0.432-25.16016 0-29.02272l0.552 0c8.27616-52.52736 52.74816-92.91648 107.26224-94.57152 45.68544 0 65.4384 24.38784 67.31472 24.38784 19.31136 18.31824 40.71984 13.90416 48.44448-8.05584l0.096-189.36382c0-19.20145-13.24224-36.30625-31.00896-40.94065-3.312 0.8832-179.76336 0-179.76336 0-43.47888 3.5328-58.70736-25.71216-34.54032-51.20352 0-1.76639 24.38784-21.62879 24.38784-67.31472-1.656-54.51361-42.04416-98.98561-94.57152-107.26225l0-0.552c-3.864-0.432-25.16064-0.432-29.02272 0l0 0.552c-52.52736 8.27664-92.91648 52.74864-94.68192 107.26225 0 45.68593 24.38784 65.43888 24.38784 67.31472 24.27744 25.49136 14.12496 53.52096-34.31952 51.20352 0 0-176.4528 0.8832-179.76336 0-17.87712 4.63681-31.11936 21.6288-31.11936 40.94065l0 579.7891c0 22.84272 18.53904 41.49264 41.49216 41.49264z"/></svg>
|
After Width: | Height: | Size: 1.1 KiB |
1
docs/static/icons/js.svg
vendored
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1000" height="1000" viewBox="0 0 1000 1000"><path class="st1" d="M843.77886 524.88744 880.276 501.83162 843.77886 478.86523c-17.00235-10.68208-30.88888-21.80904-41.21473-33.11451-9.88096-10.68206-18.15968-24.12333-24.65806-39.87966-6.85421-16.37895-11.75036-36.49708-14.5986-59.64157-3.0279-24.47957-4.53992-53.85527-4.53992-87.23694 0-34.8058-0.71245-60.79853-2.2264-79.49216-1.69206-21.72037-5.51915-37.92159-11.4832-49.49384-7.29949-14.06465-18.07062-23.94561-31.95715-29.46476-9.97002-3.916526-23.50072-6.854208-41.21512-8.81267-6.23121-0.89056-11.12736-3.740352-15.84501-9.524735-4.89614-5.964035-7.38854-15.311043-7.38854-27.862527 0-18.248344 3.82941-36.0518 49.84968-36.0518 28.30741 0 53.23225 5.607817 74.1515 16.735171 20.6517 10.949237 36.40803 26.171235 48.33612 46.556149 11.92847 20.384922 18.07062 44.241472 18.33779 71.035712 2.84979 158.1836 5.78593 189.8736 8.18966 199.93266 6.76518 28.04064 17.0019 49.40478 31.156 65.16073 12.72932 14.15371 28.21841 26.79424 46.02186 37.47631 12.90734 7.74439 22.25434 15.13294 27.95127 21.98715 1.603 1.87017 5.16331 8.10062 5.16331 24.65768 0 17.09139-5.34106 27.95158-17.35854 35.34012-26.97238 16.55706-46.37811 31.067-59.19637 44.33053-14.4209 14.86578-24.56869 33.47034-30.17683 55.19072-4.98481 19.40568-7.92251 46.73387-8.81267 83.40907-0.89056 34.44996-1.87018 77.53409-2.93885 129.25317-0.89056 41.92717-13.61976 74.24056-38.81139 98.89824-25.28105 24.65767-58.66273 36.67519-101.92497 36.67519-18.15968 0-31.60095-3.47319-39.79061-10.23717-6.8546-5.69688-10.05907-14.24277-10.05907-26.8833 0-8.01156 1.33584-14.95483 4.09464-21.2751 2.40451-5.43008 5.16331-9.43567 8.36779-11.92808 3.0279-2.31546 6.40931-3.6513 10.68206-4.18408 18.42647-2.49357 32.22434-5.60782 42.37208-9.70285 14.1541-5.78592 25.28106-16.82422 32.13527-31.86811 5.51915-11.92808 8.90173-27.86252 10.41529-48.42517 1.33584-17.89251 1.95924-43.08451 1.95924-76.82202 0.71244-47.26822 3.38412-84.3883 8.1006-110.38143 4.1837-23.58977 12.19526-43.88564 23.67845-60.44269 11.57224-16.82423 29.46475-32.9364 53.23226-47.89122zm-680.5 125.78114c2.49357 10.05907 5.34104 41.74907 8.18967 199.93305 0.27104 26.79424 6.49798 50.65079 18.33741 71.03571 11.83941 20.38492 27.68441 35.60691 48.33649 46.55615 20.91887 11.12697 45.84371 16.73517 74.15151 16.73517 46.02182 0 49.84968-17.80346 49.84968-36.05219 0-12.55148-2.49357-21.98716-7.38855-27.86213-4.71803-5.69727-9.61379-8.63495-15.845-9.52512-17.7144-1.95924-31.24511-4.89576-41.12606-8.81268-13.88692-5.51915-24.65767-15.40011-31.95716-29.46476-5.96443-11.57224-9.79191-27.68441-11.4832-49.49345-1.51395-18.78268-2.2264-44.7758-2.2264-79.49255 0-33.38128-1.51395-62.75698-4.53992-87.23693-2.93885-23.1445-7.83344-43.17319-14.68765-59.55253-6.49838-15.75594-14.7771-29.19758-24.65806-39.87966-10.4149-11.30508-24.21239-22.43243-41.21473-33.1145l-36.49708-22.96638 36.49708-23.05544c23.67844-14.95482 41.57095-31.06699 53.32132-47.89122 11.48318-16.55744 19.49474-36.85331 23.67843-60.44309 4.71803-25.99273 7.38856-63.20226 8.10061-110.38142 0-33.73751 0.62339-58.84007 1.95923-76.82164 1.51395-20.65209 4.89576-36.49708 10.41491-48.42556 6.85461-15.04387 17.98157-26.08218 32.04623-31.8681 10.05907-4.09464 23.9456-7.299501 42.37245-9.702847 4.27275-0.534336 7.65534-1.870176 10.68207-4.183696 3.20602-2.493568 6.05311-6.498382 8.3674-11.928477 2.84979-6.409315 4.18408-13.352592 4.18408-21.364145 0-12.640529-3.20602-21.186033-10.05907-26.883294-8.27872-6.765158-21.63132-10.236793-39.87967-10.236793-43.35168 0-76.73296 12.017139-101.92497 36.675192-25.19201 24.657677-37.92121 56.97067-38.81138 98.89785-1.06867 51.71908-2.04829 94.8036-2.93885 129.25317-0.97962 36.6752-3.82941 64.00339-8.81267 83.40908-5.60821 21.72036-15.75594 40.32494-30.17682 55.19071-12.9077 13.26392-32.31339 27.77347-59.285742 44.33092-12.017139 7.38816-17.358176 18.24835-17.358176 35.33974 0 16.64611 3.651296 22.78827 5.162925 24.65767 5.697261 6.76555 15.043878 14.15371 27.951586 21.98754 17.803457 10.68207 33.292227 23.32222 46.021807 37.47593 14.24277 15.84539 24.3909 37.12048 31.24511 65.16072z" style="stroke-width:11;stroke:#000"/></svg>
|
After Width: | Height: | Size: 4.1 KiB |
1
docs/static/icons/py.svg
vendored
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1000" height="1000" viewBox="0 0 1000 1000" style="clip-rule:evenodd;fill-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;version:1.1"><path d="M503.415 730.842l-1.25 28.765 228.868 2.501c0 0 0.553 83.963 0 96.3 -3.535 78.874-47.389 95.999-128.817 110.057 -81.427 14.057-171.498 5.077-205.105 0 -108.896-16.451-121.313-112.558-121.313-112.558 0 0-0.481-204.44 0-240.124 0.481-35.684 45.171-100.562 101.302-102.553 71.167-2.524 194.071 2.041 252.63 0 58.56-2.04 130.375-58.917 132.569-132.568 2.193-73.652 1.25-115.06 1.25-115.06l90.047 2.502c0 0 119.183-4.794 121.312 246.377 1.989 234.636-179.876 216.383-180.093 216.361l-291.4 0Zm129.442 173.84c-23.814 0-43.147-19.334-43.147-43.147 0-23.814 19.333-43.148 43.147-43.148 23.814 0 43.147 19.334 43.147 43.148 0 23.813-19.333 43.147-43.147 43.147Zm-424.791-641.549l291.4 0 1.25-28.765 -228.868-2.501c0 0-0.552-83.963 0-96.3 3.535-78.874 47.389-95.999 128.817-110.057 81.427-14.057 171.499-5.077 205.106 0 108.895 16.451 121.312 112.558 121.312 112.558 0 0 0.481 204.44 0 240.124 -0.481 35.684-45.171 100.562-101.302 102.553 -71.167 2.524-194.071-2.041-252.63 0 -58.56 2.04-130.375 58.917-132.569 132.568 -2.193 73.651-1.25 115.059-1.25 115.059l-90.047-2.501c0 0-119.183 4.794-121.312-246.377 -1.99-234.776 180.093-216.361 180.093-216.361Zm161.958-173.84c23.814 0 43.147 19.334 43.147 43.147 0 23.814-19.333 43.148-43.147 43.148 -23.814 0-43.147-19.334-43.147-43.148 0-23.813 19.333-43.147 43.147-43.147Z"/></svg>
|
After Width: | Height: | Size: 1.5 KiB |
2
docs/static/packages/packageicon.svg
vendored
@ -17,7 +17,7 @@
|
||||
height="176"
|
||||
viewBox="0 0 286 176"
|
||||
sodipodi:docname="packageicon.svg"
|
||||
inkscape:export-filename="/Users/sammysam/Work/pxt-microbit/docs/static/hero.png"
|
||||
inkscape:export-filename="/Users/sammysam/Work/pxt-microbit/docs/static/hero.jpg"
|
||||
inkscape:export-xdpi="100.04"
|
||||
inkscape:export-ydpi="100.04">
|
||||
<metadata
|
||||
|
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 92 KiB |
6
docs/static/testfilelogo.svg
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" id="svg4487" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.4" clip-rule="evenodd" version="1.1" width="32" height="32" viewBox="0 0 32 32">
|
||||
<path id="path4485" fill="#696969" d="M16.1 2.7a13.8 13.8 0 00-4.4 27c.7 0 1-.4 1-.7v-2.4c-3.9.9-4.7-1.8-4.7-1.8-.6-1.6-1.5-2-1.5-2-1.3-1 0-.9 0-.9 1.4.1 2.2 1.4 2.2 1.4 1.2 2.1 3.2 1.5 4 1.2a3 3 0 01.9-1.9c-3.1-.3-6.3-1.5-6.3-6.8 0-1.5.5-2.7 1.4-3.7a5 5 0 01.1-3.7s1.2-.3 3.8 1.4a13.2 13.2 0 013.5-.4c1.2 0 2.4.1 3.5.4 2.6-1.7 3.8-1.4 3.8-1.4a5 5 0 01.1 3.7c.9 1 1.4 2.2 1.4 3.7 0 5.3-3.2 6.5-6.3 6.8.5.5 1 1.3 1 2.6V29c0 .4.2.8.9.6a13.8 13.8 0 00-4.4-27"/>
|
||||
<g id="text4497" fill="#000" fill-opacity="1" stroke="none" stroke-width=".7" aria-label="v" font-family="consolas" font-size="26.6" font-stretch="normal" font-style="normal" font-variant="normal" font-weight="400" letter-spacing="0" style="line-height:1.25;-inkscape-font-specification:consolas" transform="rotate(14.1)" word-spacing="0">
|
||||
<path id="path4499" stroke-width=".7" d="M21.4-1.7l2.9 8 3-8.3.8-1.5q.4-.4 1-.4.8 0 1.2.5.5.4.5 1v.6l-.3.5-.2.7-3.4 8.4-.4 1-.5 1-.7.5q-.4.2-1 .2-.8 0-1.2-.3-.5-.3-.7-.8l-.7-1.6-3.4-8.3q0-.4-.2-.7l-.2-.6-.1-.6.2-.7.6-.6q.4-.2.9-.2.9 0 1.2.5l.7 1.7z" font-family="Arial Rounded MT Bold" font-stretch="normal" font-style="normal" font-variant="normal" font-weight="400" style="-inkscape-font-specification:'Arial Rounded MT Bold, '"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.4 KiB |
@ -897,7 +897,7 @@ function webUsbPairDialogAsync(confirmAsync: (options: any) => Promise<number>):
|
||||
<div className="ui header">{lf("First time here?")}</div>
|
||||
<strong className="ui small">{lf("You must have version 0249 or above of the firmware")}</strong>
|
||||
<div className="image">
|
||||
<img className="ui image" src="./docs/static/download/firmware.png" />
|
||||
<img className="ui image" src="./static/download/firmware.png" />
|
||||
</div>
|
||||
<a href={`${docUrl}/webusb/troubleshoot`} target="_blank">{lf("Check your firmware version here and update if needed")}</a>
|
||||
</div>
|
||||
@ -909,7 +909,7 @@ function webUsbPairDialogAsync(confirmAsync: (options: any) => Promise<number>):
|
||||
<div className="column">
|
||||
<div className="ui">
|
||||
<div className="image">
|
||||
<img className="ui medium rounded image" src="./docs/static/download/connect.png" />
|
||||
<img className="ui medium rounded image" src="./static/download/connect.png" />
|
||||
</div>
|
||||
<div className="content">
|
||||
<div className="description">
|
||||
@ -924,7 +924,7 @@ function webUsbPairDialogAsync(confirmAsync: (options: any) => Promise<number>):
|
||||
<div className="column">
|
||||
<div className="ui">
|
||||
<div className="image">
|
||||
<img className="ui medium rounded image" src="./docs/static/download/pair.png" />
|
||||
<img className="ui medium rounded image" src="./static/download/pair.png" />
|
||||
</div>
|
||||
<div className="content">
|
||||
<div className="description">
|
||||
@ -990,7 +990,7 @@ function showUploadInstructionsAsync(fn: string, url: string, confirmAsync: (opt
|
||||
<div className="column">
|
||||
<div className="ui">
|
||||
<div className="image">
|
||||
<img className="ui medium rounded image" src="./docs/static/download/connect.png" />
|
||||
<img className="ui medium rounded image" src="./static/download/connect.png" />
|
||||
</div>
|
||||
<div className="content">
|
||||
<div className="description">
|
||||
@ -1005,7 +1005,7 @@ function showUploadInstructionsAsync(fn: string, url: string, confirmAsync: (opt
|
||||
<div className="column">
|
||||
<div className="ui">
|
||||
<div className="image">
|
||||
<img className="ui medium rounded image" src="./docs/static/download/transfer.png" />
|
||||
<img className="ui medium rounded image" src="./static/download/transfer.png" />
|
||||
</div>
|
||||
<div className="content">
|
||||
<div className="description">
|
||||
|
0
external/sha/buildflash.sh
vendored
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
{
|
||||
"masterPicture": "docs/static/microbit.simplified.svg",
|
||||
"iconsPath": "/docs/static/icons",
|
||||
"iconsPath": "/static/icons",
|
||||
"design": {
|
||||
"ios": {
|
||||
"pictureAspect": "backgroundAndMargin",
|
||||
|
@ -55,6 +55,7 @@
|
||||
"Buffer.getNumber": "Read a number in specified format from the buffer.",
|
||||
"Buffer.getUint8": "Reads an unsigned byte at a particular location",
|
||||
"Buffer.indexOf": "Return position of other buffer in current buffer",
|
||||
"Buffer.isReadOnly": "Returns false when the buffer can be written to.",
|
||||
"Buffer.length": "Returns the length of a Buffer object.",
|
||||
"Buffer.rotate": "Rotate buffer left in place.\n\n\n\nstart. eg: -1",
|
||||
"Buffer.rotate|param|length": "number of elements in buffer. If negative, length is set as the buffer length minus",
|
||||
@ -194,11 +195,17 @@
|
||||
"String.indexOf|param|start": "optional start index for the search",
|
||||
"String.isEmpty": "Returns a value indicating if the string is empty",
|
||||
"String.length": "Returns the length of a String object.",
|
||||
"String.replace": "Return the current string with the first occurence of toReplace\nreplaced with the replacer\n\n\nor a function that accepts the substring and returns the replacement string.",
|
||||
"String.replaceAll": "Return the current string with each occurence of toReplace\nreplaced with the replacer\n\n\nor a function that accepts the substring and returns the replacement string.",
|
||||
"String.replaceAll|param|replacer": "either the string that replaces toReplace in the current string,",
|
||||
"String.replaceAll|param|toReplace": "the substring to replace in the current string",
|
||||
"String.replace|param|replacer": "either the string that replaces toReplace in the current string,",
|
||||
"String.replace|param|toReplace": "the substring to replace in the current string",
|
||||
"String.slice": "Return a substring of the current string.",
|
||||
"String.slice|param|end": "one-past-last character index",
|
||||
"String.slice|param|start": "first character index; can be negative from counting from the end, eg:0",
|
||||
"String.split": "Splits the string according to the separators",
|
||||
"String.split|param|separator": "@param limit ",
|
||||
"String.split|param|separator": "@param limit",
|
||||
"String.substr": "Return a substring of the current string.",
|
||||
"String.substr|param|length": "number of characters to extract",
|
||||
"String.substr|param|start": "first character index; can be negative from counting from the end, eg:0",
|
||||
@ -472,18 +479,35 @@
|
||||
"parseFloat": "Convert a string to a number.",
|
||||
"parseInt": "Convert a string to an integer.",
|
||||
"pins": "Control currents in Pins for analog/digital signals, servos, i2c, ...",
|
||||
"pins.C10": "Pin C10",
|
||||
"pins.C11": "Pin C11",
|
||||
"pins.C12": "Pin C12",
|
||||
"pins.C16": "Pin C16",
|
||||
"pins.C17": "Pin C17",
|
||||
"pins.C18": "Pin C18",
|
||||
"pins.C19": "Pin C19",
|
||||
"pins.C4": "Pin C4",
|
||||
"pins.C5": "Pin C5",
|
||||
"pins.C6": "Pin C6",
|
||||
"pins.C7": "Pin C7",
|
||||
"pins.C8": "Pin C8",
|
||||
"pins.C9": "Pin C9",
|
||||
"pins.P0": "Pin P0",
|
||||
"pins.P1": "Pin P1",
|
||||
"pins.P2": "Pin P2",
|
||||
"pins.P3": "Pin P3",
|
||||
"pins.analogPitch": "Emit a plse-width modulation (PWM) signal to the current pitch pin. Use `analog set pitch pin` to define the pitch pin.",
|
||||
"pins.analogPitch|param|frequency": "frequency to modulate in Hz.",
|
||||
"pins.analogPitch|param|ms": "duration of the pitch in milli seconds.",
|
||||
"pins.analogReadPin": "Read the connector value as analog, that is, as a value comprised between 0 and 1023.",
|
||||
"pins.analogReadPin|param|name": "pin to write to, eg: AnalogPin.P0",
|
||||
"pins.analogReadPin|param|name": "pin to write to, eg: AnalogPin.P1",
|
||||
"pins.analogSetPeriod": "Configure the pulse-width modulation (PWM) period of the analog output in microseconds.\nIf this pin is not configured as an analog output (using `analog write pin`), the operation has no effect.",
|
||||
"pins.analogSetPeriod|param|micros": "period in micro seconds. eg:20000",
|
||||
"pins.analogSetPeriod|param|name": "analog pin to set period to, eg: AnalogPin.P0",
|
||||
"pins.analogSetPeriod|param|name": "analog pin to set period to, eg: AnalogPin.P1",
|
||||
"pins.analogSetPitchPin": "Set the pin used when using analog pitch or music.",
|
||||
"pins.analogSetPitchPin|param|name": "pin to modulate pitch from",
|
||||
"pins.analogWritePin": "Set the connector value as analog. Value must be comprised between 0 and 1023.",
|
||||
"pins.analogWritePin|param|name": "pin name to write to, eg: AnalogPin.P0",
|
||||
"pins.analogWritePin|param|name": "pin name to write to, eg: AnalogPin.P1",
|
||||
"pins.analogWritePin|param|value": "value to write to the pin between ``0`` and ``1023``. eg:1023,0",
|
||||
"pins.createBuffer": "Create a new zero-initialized buffer.",
|
||||
"pins.createBufferFromArray": "Create a new buffer initalized to bytes from given array.",
|
||||
@ -515,7 +539,7 @@
|
||||
"pins.servoSetPulse|param|micros": "pulse duration in micro seconds, eg:1500",
|
||||
"pins.servoSetPulse|param|name": "pin name",
|
||||
"pins.servoWritePin": "Write a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement).",
|
||||
"pins.servoWritePin|param|name": "pin to write to, eg: AnalogPin.P0",
|
||||
"pins.servoWritePin|param|name": "pin to write to, eg: AnalogPin.P1",
|
||||
"pins.servoWritePin|param|value": "angle or rotation speed, eg:180,90,0",
|
||||
"pins.setEvents": "Configure the events emitted by this pin. Events can be subscribed to\nusing ``control.onEvent()``.",
|
||||
"pins.setEvents|param|name": "pin to set the event mode on, eg: DigitalPin.P0",
|
||||
|
@ -215,6 +215,10 @@
|
||||
"Note.GSharp|block": "G#",
|
||||
"Number|block": "Number",
|
||||
"Object|block": "Object",
|
||||
"PinEvent.Fall|block": "fall",
|
||||
"PinEvent.PulseHigh|block": "pulse high",
|
||||
"PinEvent.PulseLow|block": "pulse low",
|
||||
"PinEvent.Rise|block": "rise",
|
||||
"PinEventType.Edge|block": "edge",
|
||||
"PinEventType.None|block": "none",
|
||||
"PinEventType.Pulse|block": "pulse",
|
||||
@ -384,6 +388,8 @@
|
||||
"serial.writeString|block": "serial|write string %text",
|
||||
"serial.writeValue|block": "serial|write value %name|= %value",
|
||||
"serial|block": "serial",
|
||||
"{id:category}AnalogInPin": "AnalogInPin",
|
||||
"{id:category}AnalogOutPin": "AnalogOutPin",
|
||||
"{id:category}Array": "Array",
|
||||
"{id:category}Arrays": "Arrays",
|
||||
"{id:category}Basic": "Basic",
|
||||
@ -391,6 +397,7 @@
|
||||
"{id:category}Buffer": "Buffer",
|
||||
"{id:category}Console": "Console",
|
||||
"{id:category}Control": "Control",
|
||||
"{id:category}DigitalInOutPin": "DigitalInOutPin",
|
||||
"{id:category}Fx": "Fx",
|
||||
"{id:category}Fx8": "Fx8",
|
||||
"{id:category}Game": "Game",
|
||||
@ -400,12 +407,14 @@
|
||||
"{id:category}Input": "Input",
|
||||
"{id:category}Led": "Led",
|
||||
"{id:category}Math": "Math",
|
||||
"{id:category}MicrobitPin": "MicrobitPin",
|
||||
"{id:category}Motors": "Motors",
|
||||
"{id:category}Msgpack": "Msgpack",
|
||||
"{id:category}Music": "Music",
|
||||
"{id:category}Number": "Number",
|
||||
"{id:category}Object": "Object",
|
||||
"{id:category}Pins": "Pins",
|
||||
"{id:category}PwmOnlyPin": "PwmOnlyPin",
|
||||
"{id:category}Serial": "Serial",
|
||||
"{id:category}String": "String",
|
||||
"{id:category}Text": "Text"
|
||||
|
@ -31,6 +31,7 @@ void platform_init() {
|
||||
}
|
||||
|
||||
void initMicrobitGC() {
|
||||
uBit.init();
|
||||
if (device_heap_size(1) > NON_GC_HEAP_RESERVATION + 4)
|
||||
gcPreAllocateBlock(device_heap_size(1) - NON_GC_HEAP_RESERVATION);
|
||||
}
|
||||
@ -43,9 +44,6 @@ struct FreeList {
|
||||
};
|
||||
|
||||
static void initCodal() {
|
||||
|
||||
uBit.init();
|
||||
|
||||
// repeat error 4 times and restart as needed
|
||||
microbit_panic_timeout(4);
|
||||
}
|
||||
@ -224,7 +222,6 @@ void sendSerial(const char *data, int len) {
|
||||
logwriten(data, len);
|
||||
}
|
||||
|
||||
#ifdef PXT_GC
|
||||
ThreadContext *getThreadContext() {
|
||||
if (!currentFiber)
|
||||
return NULL;
|
||||
@ -275,6 +272,5 @@ void gcProcessStacks(int flags) {
|
||||
}
|
||||
xfree(fibers);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace pxt
|
||||
|
15
libs/core/enums.d.ts
vendored
@ -512,15 +512,12 @@ declare namespace motors {
|
||||
|
||||
|
||||
declare const enum SerialPin {
|
||||
P0 = 7, // MICROBIT_ID_IO_P0
|
||||
P1 = 8, // MICROBIT_ID_IO_P1
|
||||
P2 = 9, // MICROBIT_ID_IO_P2
|
||||
P8 = 15, // MICROBIT_ID_IO_P8
|
||||
P12 = 19, // MICROBIT_ID_IO_P12
|
||||
P13 = 20, // MICROBIT_ID_IO_P13
|
||||
P14 = 21, // MICROBIT_ID_IO_P14
|
||||
P15 = 22, // MICROBIT_ID_IO_P15
|
||||
P16 = 23, // MICROBIT_ID_IO_P16
|
||||
P0 = 19, // MICROBIT_ID_IO_P12
|
||||
P1 = 7, // MICROBIT_ID_IO_P0
|
||||
P2 = 8, // MICROBIT_ID_IO_P1
|
||||
P3 = 23, // MICROBIT_ID_IO_P16
|
||||
C16 = 9, // MICROBIT_ID_IO_P2
|
||||
C17 = 15, // MICROBIT_ID_IO_P8
|
||||
USB_TX = 1001,
|
||||
USB_RX = 1002,
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ namespace motors {
|
||||
*/
|
||||
//% blockId=motor_on block="motor on at %percent"
|
||||
//% parts=dcmotor weight=90 blockGap=8
|
||||
//% percent.shadow="speedPicker"
|
||||
void motorPower(int power) {
|
||||
uBit.soundmotor.motorOn(power);
|
||||
}
|
||||
@ -48,6 +49,7 @@ namespace motors {
|
||||
* Controls two motors attached to the board. Switches to dual-motor mode!
|
||||
*/
|
||||
//% blockId=block_dual_motor block="motor %motor|at %percent"
|
||||
//% percent.shadow="speedPicker"
|
||||
//% weight=80
|
||||
void dualMotorPower(Motor motor, int duty_percent) {
|
||||
switch(motor) {
|
||||
|
@ -134,7 +134,7 @@ namespace pins {
|
||||
|
||||
/**
|
||||
* Read the connector value as analog, that is, as a value comprised between 0 and 1023.
|
||||
* @param name pin to write to, eg: AnalogPin.P0
|
||||
* @param name pin to write to, eg: AnalogPin.P1
|
||||
*/
|
||||
//% help=pins/analog-read-pin weight=25
|
||||
//% blockId=device_get_analog_pin block="analog read|pin %name" blockGap="8"
|
||||
@ -146,7 +146,7 @@ namespace pins {
|
||||
|
||||
/**
|
||||
* Set the connector value as analog. Value must be comprised between 0 and 1023.
|
||||
* @param name pin name to write to, eg: AnalogPin.P0
|
||||
* @param name pin name to write to, eg: AnalogPin.P1
|
||||
* @param value value to write to the pin between ``0`` and ``1023``. eg:1023,0
|
||||
*/
|
||||
//% help=pins/analog-write-pin weight=24
|
||||
@ -161,7 +161,7 @@ namespace pins {
|
||||
/**
|
||||
* Configure the pulse-width modulation (PWM) period of the analog output in microseconds.
|
||||
* If this pin is not configured as an analog output (using `analog write pin`), the operation has no effect.
|
||||
* @param name analog pin to set period to, eg: AnalogPin.P0
|
||||
* @param name analog pin to set period to, eg: AnalogPin.P1
|
||||
* @param micros period in micro seconds. eg:20000
|
||||
*/
|
||||
//% help=pins/analog-set-period weight=23 blockGap=8
|
||||
@ -244,7 +244,7 @@ namespace pins {
|
||||
|
||||
/**
|
||||
* Write a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement).
|
||||
* @param name pin to write to, eg: AnalogPin.P0
|
||||
* @param name pin to write to, eg: AnalogPin.P1
|
||||
* @param value angle or rotation speed, eg:180,90,0
|
||||
*/
|
||||
//% help=pins/servo-write-pin weight=20
|
||||
|
220
libs/core/pinscompat.ts
Normal file
@ -0,0 +1,220 @@
|
||||
const enum PinEvent {
|
||||
//% block="pulse high"
|
||||
PulseHigh = DAL.MICROBIT_PIN_EVT_PULSE_HI, // DEVICE_PIN_EVT_PULSE_HI
|
||||
//% block="pulse low"
|
||||
PulseLow = DAL.MICROBIT_PIN_EVT_PULSE_LO, // DEVICE_PIN_EVT_PULSE_LO
|
||||
//% block="rise"
|
||||
Rise = DAL.MICROBIT_PIN_EVT_RISE, // DEVICE_PIN_EVT_RISE
|
||||
//% block="fall"
|
||||
Fall = DAL.MICROBIT_PIN_EVT_FALL, // DEVICE_PIN_EVT_FALL
|
||||
}
|
||||
|
||||
//% noRefCounting fixedInstances
|
||||
interface DigitalInOutPin {
|
||||
digitalRead(): boolean;
|
||||
|
||||
digitalWrite(value: boolean): void;
|
||||
|
||||
onPulsed(pulse: PulseValue, body: () => void): void;
|
||||
|
||||
onEvent(event: PinEvent, body: () => void): void;
|
||||
|
||||
pulseIn(value: PulseValue, maxDuration?: number): number;
|
||||
|
||||
setPull(pull: PinPullMode): void;
|
||||
}
|
||||
|
||||
//% noRefCounting fixedInstances
|
||||
interface AnalogInPin extends DigitalInOutPin {
|
||||
analogRead(): number;
|
||||
}
|
||||
|
||||
//% noRefCounting fixedInstances
|
||||
interface AnalogOutPin extends DigitalInOutPin {
|
||||
analogWrite(value: number): void;
|
||||
}
|
||||
|
||||
//% noRefCounting fixedInstances
|
||||
interface AnalogInOutPin extends AnalogInPin, AnalogOutPin {
|
||||
}
|
||||
|
||||
//% noRefCounting fixedInstances
|
||||
interface PwmOnlyPin extends DigitalInOutPin, AnalogOutPin {
|
||||
//% parts=microservo trackArgs=0
|
||||
analogSetPeriod(period: number): void;
|
||||
|
||||
//% parts=microservo trackArgs=0
|
||||
servoWrite(value: number): void;
|
||||
|
||||
//% parts=microservo trackArgs=0
|
||||
servoSetPulse(duration: number): void;
|
||||
}
|
||||
|
||||
//% noRefCounting fixedInstances
|
||||
interface PwmPin extends PwmOnlyPin, DigitalInOutPin, AnalogInPin {
|
||||
}
|
||||
|
||||
//% noRefCounting fixedInstances
|
||||
class MicrobitPin implements AnalogInPin, AnalogOutPin, AnalogInOutPin, PwmOnlyPin {
|
||||
public id: number;
|
||||
constructor(id: number) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
protected digitalId(): DigitalPin {
|
||||
return <DigitalPin>this.id;
|
||||
}
|
||||
|
||||
protected analogId(): AnalogPin {
|
||||
return <AnalogPin>this.id;
|
||||
}
|
||||
|
||||
digitalRead(): boolean {
|
||||
return pins.digitalReadPin(this.digitalId()) != 0;
|
||||
}
|
||||
|
||||
digitalWrite(value: boolean): void {
|
||||
pins.digitalWritePin(this.digitalId(), value ? 1 : 0);
|
||||
}
|
||||
|
||||
onPulsed(pulse: PulseValue, body: () => void): void {
|
||||
pins.onPulsed(this.digitalId(), pulse, body);
|
||||
}
|
||||
|
||||
onEvent(event: PinEvent, body: () => void): void {
|
||||
// TODO
|
||||
}
|
||||
|
||||
pulseIn(value: PulseValue, maxDuration?: number): number {
|
||||
return pins.pulseIn(this.digitalId(), value, maxDuration);
|
||||
}
|
||||
|
||||
setPull(pull: PinPullMode): void {
|
||||
pins.setPull(this.digitalId(), pull);
|
||||
}
|
||||
|
||||
analogRead(): number {
|
||||
return pins.analogReadPin(this.analogId());
|
||||
}
|
||||
|
||||
analogWrite(value: number): void {
|
||||
pins.analogWritePin(this.analogId(), value);
|
||||
}
|
||||
|
||||
analogSetPeriod(period: number): void {
|
||||
pins.analogSetPeriod(this.analogId(), period);
|
||||
}
|
||||
|
||||
servoWrite(value: number): void {
|
||||
pins.servoWritePin(this.analogId(), value);
|
||||
}
|
||||
|
||||
servoSetPulse(duration: number): void {
|
||||
pins.servoSetPulse(this.analogId(), duration);
|
||||
}
|
||||
}
|
||||
|
||||
namespace pins {
|
||||
/**
|
||||
* Pin P0
|
||||
*/
|
||||
//% fixedInstance whenUsed
|
||||
export const P0: PwmPin = new MicrobitPin(DigitalPin.P0);
|
||||
|
||||
/**
|
||||
* Pin P1
|
||||
*/
|
||||
//% fixedInstance whenUsed
|
||||
export const P1: AnalogInPin = new MicrobitPin(DigitalPin.P1);
|
||||
|
||||
/**
|
||||
* Pin P2
|
||||
*/
|
||||
//% fixedInstance whenUsed
|
||||
export const P2: AnalogInPin = new MicrobitPin(DigitalPin.P2);
|
||||
|
||||
/**
|
||||
* Pin P3
|
||||
*/
|
||||
//% fixedInstance whenUsed
|
||||
export const P3: PwmPin = new MicrobitPin(DigitalPin.P3);
|
||||
|
||||
/**
|
||||
* Pin C4
|
||||
*/
|
||||
//% fixedInstance whenUsed
|
||||
export const C4: AnalogInPin = new MicrobitPin(DigitalPin.C4);
|
||||
|
||||
/**
|
||||
* Pin C5
|
||||
*/
|
||||
//% fixedInstance whenUsed
|
||||
export const C5: AnalogInPin = new MicrobitPin(DigitalPin.C5);
|
||||
|
||||
/**
|
||||
* Pin C6
|
||||
*/
|
||||
//% fixedInstance whenUsed
|
||||
export const C6: AnalogInPin = new MicrobitPin(DigitalPin.C6);
|
||||
|
||||
/**
|
||||
* Pin C7
|
||||
*/
|
||||
//% fixedInstance whenUsed
|
||||
export const C7: DigitalInOutPin = new MicrobitPin(DigitalPin.C7);
|
||||
|
||||
/**
|
||||
* Pin C8
|
||||
*/
|
||||
//% fixedInstance whenUsed
|
||||
export const C8: DigitalInOutPin = new MicrobitPin(DigitalPin.C8);
|
||||
|
||||
/**
|
||||
* Pin C9
|
||||
*/
|
||||
//% fixedInstance whenUsed
|
||||
export const C9: DigitalInOutPin = new MicrobitPin(DigitalPin.C9);
|
||||
|
||||
/**
|
||||
* Pin C10
|
||||
*/
|
||||
//% fixedInstance whenUsed
|
||||
export const C10: DigitalInOutPin = new MicrobitPin(DigitalPin.C10);
|
||||
|
||||
/**
|
||||
* Pin C11
|
||||
*/
|
||||
//% fixedInstance whenUsed
|
||||
export const C11: DigitalInOutPin = new MicrobitPin(DigitalPin.C11);
|
||||
|
||||
/**
|
||||
* Pin C12
|
||||
*/
|
||||
//% fixedInstance whenUsed
|
||||
export const C12: DigitalInOutPin = new MicrobitPin(DigitalPin.C12);
|
||||
|
||||
|
||||
/**
|
||||
* Pin C16
|
||||
*/
|
||||
//% fixedInstance whenUsed
|
||||
export const C16: AnalogInPin = new MicrobitPin(DigitalPin.C16);
|
||||
|
||||
/**
|
||||
* Pin C17
|
||||
*/
|
||||
//% fixedInstance whenUsed
|
||||
export const C17: AnalogInPin = new MicrobitPin(DigitalPin.C17);
|
||||
|
||||
/**
|
||||
* Pin C18
|
||||
*/
|
||||
//% fixedInstance whenUsed
|
||||
export const C18: DigitalInOutPin = new MicrobitPin(DigitalPin.C18);
|
||||
|
||||
/**
|
||||
* Pin C19
|
||||
*/
|
||||
//% fixedInstance whenUsed
|
||||
export const C19: DigitalInOutPin = new MicrobitPin(DigitalPin.C19);
|
||||
}
|
@ -13,10 +13,11 @@
|
||||
"dal.d.ts",
|
||||
"enums.d.ts",
|
||||
"shims.d.ts",
|
||||
"pxt-core.d.ts",
|
||||
"pxt-core.d.ts",
|
||||
"core.cpp",
|
||||
"pxt-helpers.ts",
|
||||
"helpers.ts",
|
||||
"pinscompat.ts",
|
||||
"configkeys.h",
|
||||
"gc.cpp",
|
||||
"codal.cpp",
|
||||
|
@ -4,15 +4,12 @@
|
||||
|
||||
// make sure USB_TX and USB_RX don't overlap with other pin ids
|
||||
enum SerialPin {
|
||||
P0 = MICROBIT_ID_IO_P0,
|
||||
P1 = MICROBIT_ID_IO_P1,
|
||||
P2 = MICROBIT_ID_IO_P2,
|
||||
P8 = MICROBIT_ID_IO_P8,
|
||||
P12 = MICROBIT_ID_IO_P12,
|
||||
P13 = MICROBIT_ID_IO_P13,
|
||||
P14 = MICROBIT_ID_IO_P14,
|
||||
P15 = MICROBIT_ID_IO_P15,
|
||||
P16 = MICROBIT_ID_IO_P16,
|
||||
P0 = MICROBIT_ID_IO_P12,
|
||||
P1 = MICROBIT_ID_IO_P0,
|
||||
P2 = MICROBIT_ID_IO_P1,
|
||||
P3 = MICROBIT_ID_IO_P16,
|
||||
C16 = MICROBIT_ID_IO_P2,
|
||||
C17 = MICROBIT_ID_IO_P8,
|
||||
USB_TX = 1001,
|
||||
USB_RX = 1002
|
||||
};
|
||||
|
18
libs/core/shims.d.ts
vendored
@ -599,7 +599,8 @@ declare namespace motors {
|
||||
* @param power %percent of power sent to the motor. Negative power goes backward. eg: 50
|
||||
*/
|
||||
//% blockId=motor_on block="motor on at %percent"
|
||||
//% parts=dcmotor weight=90 blockGap=8 shim=motors::motorPower
|
||||
//% parts=dcmotor weight=90 blockGap=8
|
||||
//% percent.shadow="speedPicker" shim=motors::motorPower
|
||||
function motorPower(power: int32): void;
|
||||
|
||||
/**
|
||||
@ -613,6 +614,7 @@ declare namespace motors {
|
||||
* Controls two motors attached to the board. Switches to dual-motor mode!
|
||||
*/
|
||||
//% blockId=block_dual_motor block="motor %motor|at %percent"
|
||||
//% percent.shadow="speedPicker"
|
||||
//% weight=80 shim=motors::dualMotorPower
|
||||
function dualMotorPower(motor: Motor, duty_percent: int32): void;
|
||||
}
|
||||
@ -653,7 +655,7 @@ declare namespace pins {
|
||||
|
||||
/**
|
||||
* Read the connector value as analog, that is, as a value comprised between 0 and 1023.
|
||||
* @param name pin to write to, eg: AnalogPin.P0
|
||||
* @param name pin to write to, eg: AnalogPin.P1
|
||||
*/
|
||||
//% help=pins/analog-read-pin weight=25
|
||||
//% blockId=device_get_analog_pin block="analog read|pin %name" blockGap="8"
|
||||
@ -663,7 +665,7 @@ declare namespace pins {
|
||||
|
||||
/**
|
||||
* Set the connector value as analog. Value must be comprised between 0 and 1023.
|
||||
* @param name pin name to write to, eg: AnalogPin.P0
|
||||
* @param name pin name to write to, eg: AnalogPin.P1
|
||||
* @param value value to write to the pin between ``0`` and ``1023``. eg:1023,0
|
||||
*/
|
||||
//% help=pins/analog-write-pin weight=24
|
||||
@ -676,7 +678,7 @@ declare namespace pins {
|
||||
/**
|
||||
* Configure the pulse-width modulation (PWM) period of the analog output in microseconds.
|
||||
* If this pin is not configured as an analog output (using `analog write pin`), the operation has no effect.
|
||||
* @param name analog pin to set period to, eg: AnalogPin.P0
|
||||
* @param name analog pin to set period to, eg: AnalogPin.P1
|
||||
* @param micros period in micro seconds. eg:20000
|
||||
*/
|
||||
//% help=pins/analog-set-period weight=23 blockGap=8
|
||||
@ -719,7 +721,7 @@ declare namespace pins {
|
||||
|
||||
/**
|
||||
* Write a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement).
|
||||
* @param name pin to write to, eg: AnalogPin.P0
|
||||
* @param name pin to write to, eg: AnalogPin.P1
|
||||
* @param value angle or rotation speed, eg:180,90,0
|
||||
*/
|
||||
//% help=pins/servo-write-pin weight=20
|
||||
@ -950,6 +952,12 @@ declare interface Buffer {
|
||||
//% shim=BufferMethods::getUint8
|
||||
getUint8(off: int32): int32;
|
||||
|
||||
/**
|
||||
* Returns false when the buffer can be written to.
|
||||
*/
|
||||
//% shim=BufferMethods::isReadOnly
|
||||
isReadOnly(): boolean;
|
||||
|
||||
/**
|
||||
* Writes an unsigned byte at a particular location
|
||||
*/
|
||||
|
3
libs/servo/pxt.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/servo"
|
||||
}
|
8
libs/servo/targetoverrides.ts
Normal file
@ -0,0 +1,8 @@
|
||||
namespace servos {
|
||||
//% block="servo P0" fixedInstance whenUsed
|
||||
export const P0 = new servos.PinServo(pins.P0);
|
||||
//% block="servo P1" fixedInstance whenUsed
|
||||
export const P1 = new servos.PinServo(pins.P1);
|
||||
//% block="servo P2" fixedInstance whenUsed
|
||||
export const P2 = new servos.PinServo(pins.P2);
|
||||
}
|
3794
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pxt-calliope",
|
||||
"version": "2.1.29",
|
||||
"version": "2.1.46",
|
||||
"description": "micro:bit target for Microsoft MakeCode (PXT)",
|
||||
"keywords": [
|
||||
"JavaScript",
|
||||
@ -34,7 +34,6 @@
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/bluebird": "2.0.33",
|
||||
"@types/jquery": "3.2.16",
|
||||
"@types/marked": "0.3.0",
|
||||
"@types/node": "8.0.53",
|
||||
"@types/react": "16.0.25",
|
||||
@ -43,10 +42,10 @@
|
||||
"less": "2.7.3",
|
||||
"react": "16.8.3",
|
||||
"semantic-ui-less": "2.2.14",
|
||||
"typescript": "2.6.1"
|
||||
"typescript": "^3.7.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"pxt-common-packages": "6.17.1",
|
||||
"pxt-core": "5.30.28"
|
||||
"pxt-common-packages": "6.18.4",
|
||||
"pxt-core": "5.33.5"
|
||||
}
|
||||
}
|
||||
|
@ -269,6 +269,7 @@
|
||||
"productId": "0x0204",
|
||||
"rawHID": true
|
||||
},
|
||||
"ignoreDocsErrors": true,
|
||||
"appTheme": {
|
||||
"accentColor": "#249899",
|
||||
"defaultLocale": "de",
|
||||
@ -283,7 +284,7 @@
|
||||
"organizationUrl": "https://makecode.com/",
|
||||
"organizationLogo": "./static/Microsoft-logo_rgb_c-gray-square.png",
|
||||
"organizationWideLogo": "./static/Microsoft-logo_rgb_c-white.png",
|
||||
"homeScreenHero": "./static/hero.png",
|
||||
"homeScreenHero": "./static/hero.jpg",
|
||||
"homeUrl": "https://makecode.calliope.cc/",
|
||||
"embedUrl": "https://makecode.calliope.cc/",
|
||||
"shareUrl": "https://makecode.calliope.cc/",
|
||||
@ -298,7 +299,6 @@
|
||||
"extendEditor": true,
|
||||
"extendFieldEditors": true,
|
||||
"enableTrace": true,
|
||||
"ignoreDocsErrors": true,
|
||||
"experiments": [
|
||||
"allowPackageExtensions",
|
||||
"instructions",
|
||||
@ -419,7 +419,9 @@
|
||||
"simGifTransparent": "rgba(0,0,0,0)",
|
||||
"simGifMaxFrames": 44,
|
||||
"simScreenshotMaxUriLength": 300000,
|
||||
"importExtensionFiles": true
|
||||
"importExtensionFiles": true,
|
||||
"githubEditor": true,
|
||||
"tutorialBlocksDiff": true
|
||||
},
|
||||
"queryVariants": {
|
||||
"hidemenu": {
|
||||
@ -427,5 +429,6 @@
|
||||
"hideMenuBar": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"disableDocsUpload": true
|
||||
}
|
0
resources/gestures/BackSideUp.svg
Normal file → Executable file
Before Width: | Height: | Size: 650 B After Width: | Height: | Size: 650 B |
0
resources/gestures/FreeFall.svg
Normal file → Executable file
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
0
resources/gestures/FrontSideUp.svg
Normal file → Executable file
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
0
resources/gestures/Impact3G.svg
Normal file → Executable file
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
0
resources/gestures/Impact6G.svg
Normal file → Executable file
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
0
resources/gestures/Impact8G.svg
Normal file → Executable file
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
0
resources/gestures/Shake.svg
Normal file → Executable file
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
0
resources/gestures/TiltBackward.svg
Normal file → Executable file
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
0
resources/gestures/TiltForward.svg
Normal file → Executable file
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
0
resources/gestures/TiltLeft.svg
Normal file → Executable file
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
0
resources/gestures/TiltRight.svg
Normal file → Executable file
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
@ -61,7 +61,7 @@ namespace pxsim.pins {
|
||||
let pin = getPin(pinId);
|
||||
if (!pin) return;
|
||||
pin.mode = PinFlags.Analog | PinFlags.Output;
|
||||
pin.value = value ? 1 : 0;
|
||||
pin.value = value ? value : 0;
|
||||
runtime.queueDisplayUpdate();
|
||||
}
|
||||
|
||||
|
@ -3,4 +3,9 @@ namespace pxsim.basic {
|
||||
board().rgbLedState = c;
|
||||
runtime.queueDisplayUpdate()
|
||||
}
|
||||
|
||||
export function turnRgbLedOff() {
|
||||
board().rgbLedState = 0;
|
||||
runtime.queueDisplayUpdate()
|
||||
}
|
||||
}
|
@ -9,7 +9,7 @@
|
||||
"newLine": "LF",
|
||||
"sourceMap": false,
|
||||
"lib": ["dom", "dom.iterable", "scripthost", "es6"],
|
||||
"types": ["jquery", "bluebird"],
|
||||
"types": ["bluebird"],
|
||||
"typeRoots": ["../node_modules/@types"]
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ namespace pxsim.visuals {
|
||||
this.canvas.appendChild(pixel.el);
|
||||
}
|
||||
let color = colors[i];
|
||||
pixel.setRgb(color);
|
||||
pixel.setRgb([color[0], color[1], color[2]]);
|
||||
}
|
||||
|
||||
//show the canvas if it's hidden
|
||||
|
@ -179,7 +179,13 @@
|
||||
"assirati/pxt-inventura",
|
||||
"Veilkrand/pxt-RobotCar",
|
||||
"4tronix/DriveBit",
|
||||
"Freenove/Makecode-Extension-Starter-Kit"
|
||||
"Freenove/Makecode-Extension-Starter-Kit",
|
||||
"sphero-inc/sphero-sdk-microbit-makecode",
|
||||
"BrightWearables/pxt-microbit-brightboard",
|
||||
"EBOTICS/pxt-eboticsMIBO",
|
||||
"KitronikLtd/pxt-kitronik-halohd",
|
||||
"dugbraden/pxt-climate-action-kit",
|
||||
"alsrobot-microbit-makecode-packages/MiniCruise"
|
||||
],
|
||||
"preferredRepos": [
|
||||
"Microsoft/pxt-neopixel",
|
||||
@ -222,7 +228,7 @@
|
||||
],
|
||||
"galleries": {
|
||||
"First Steps": "calliope/firststeps",
|
||||
"Turorials": "calliope/tutorials",
|
||||
"Tutorials": "calliope/tutorials",
|
||||
"Calliope Links": "calliope/links"
|
||||
},
|
||||
"electronManifest": {
|
||||
|