Skip to content

Commit

Permalink
Update default settings for mini 1 and mini 2 (#222)
Browse files Browse the repository at this point in the history
* Align BLE settings across editors

* Align BLE and RAM with v5 settings

* update user settings

* Revert "update user settings"

This reverts commit ed0f017.

* add grove pin class

* add pins to digital & analog

* fix grove pins

* fix commas

* update grove pins

* update codecards

* update codecard text

* Codecards update

* update starter templates

* Update neu.md

* Update calliope.md

* Update neu.md

* Update calliope.md

* Delete Calliope mini v1 no BLE templates, update template summary

This commit removes the Calliope mini v1 no BLE templates from the codebase. It also updates the template summary to reflect these changes. Additionally, it modifies the pxt.json file to disable Bluetooth and enable partial flashing mode for Bluetooth. Finally, it increases RAM size to 32 KB for Calliope mini 2.0 onwards.

* update template ble settings

* Update templates and template info

* update docs and user settings

* Align strings

* enums and docs

* Fix button events in tutorials, test and docs

Change Button and Pin blocks to use default value when the event type is "clicked"

closes #221

* revert url in old templates to old url to prevent changes in curent release

---------

Co-authored-by: Jørn Alraun <ja@urbn-pockets.com>
  • Loading branch information
Amerlander and joernalraun authored Jun 28, 2023
1 parent b0af4b5 commit ceeeaef
Show file tree
Hide file tree
Showing 41 changed files with 1,839 additions and 132 deletions.
22 changes: 22 additions & 0 deletions docs/calliope/neu.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Choosing the right template for Calliope mini

No matter which version of Calliope mini you have or whether you’re programming on a mobile device or PC, you can always create a **`|New Project|`** and start programming.

If you’re using a Calliope mini 2, we suggest to use the optimized template **`|input:Calliope mini 2.x|`**. This allows you to transfer programs faster via Bluetooth and create more complex programs, due to partial flashing and a full usage of the available RAM. The settings loaded with the **`|input:Calliope mini 2.x|`** template can also be activated in any existing project through the settings menu.

If you encounter issues with the default template (**`|functions:Calliope mini 1.x|`** or **`|New Project|`**) and your Calliope mini freezes, it may be due to limited available program memory (RAM). To free up more memory for your program we suggest switching on “Manual Bluetooth activation”. In this case each time you transfer programs you have to set the Calliope mini into Bluetooth mode. To do this, perform the “brace grip”: hold down buttons **`A`** and **`B`**, briefly tap the **`Reset`** button, and continue holding **`A`** and **`B`** until the pattern appears on the LED matrix.

## Additional Notes for iOS Users:

**We recommend that every user of the Calliope mini 2.x updates their device with the Demo Program once.**

If you have previously programmed your Calliope mini with another editor or flashed it with the last **`|input:Calliope mini 2.x|`** template, you cannot transfer the default project template directly from mobile. The Bluetooth settings have changed in this template, so one of the following steps is necessary so that you can transfer your program to mobile devices without any problems:

### Option A: Load program 25 (Demo Program):
To load the Program with the number **`25`** onto your Calliope mini, follow these steps:
1. Press and hold the reset button on your Calliope mini for approximately 5 seconds until all LEDs briefly light up and then turn off.
2. Press the **`A`** button to go back one step. This will illuminate the 25th LED on the display.
3. Press the **`A`** and **`B`** buttons simultaneously to confirm your selection and load Program 25. This process also resolves any other transfer issues. Once completed, your Calliope mini will be restored to its default state.

### Option B: Load the Demo Program:
In the Calliope mini app, navigate to the **`Editors and Programs`** section and locate the **`Start Program`** option. Load this program onto your Calliope mini, and you’ll be able to use the standard project template without any concerns.
34 changes: 17 additions & 17 deletions docs/calliope/templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ Here are some cool tutorials to get you started with your @boardname@!

```codecard
[
{
"name": "Calliope mini 2.x",
"url":"_f7ACuxgaocvr",
"description": "The Calliope mini 2.0 and newer has a larger memory than the previous versions. If you use this template for your project, you can make the most of all the features on your Calliope mini!",
"imageUrl": "/calliope/templates/32KB.png",
"largeImageUrl": "/calliope/templates/32KB_L.png",
"cardType": "sharedExample",
"buttonLabel": "New project"
},{
"name": "Calliope mini 1.x",
"url":"_7YbU6iMhoTdR",
"description": "This template is designed for all Calliope mini, but especially for those up to version 1.3. If you have such a Calliope mini or an earlier version, you can start directly with this template.",
"imageUrl": "/calliope/templates/16KB.png",
"largeImageUrl": "/calliope/templates/16KB_L.png",
"cardType": "sharedExample",
"buttonLabel": "New project"
}
{
"name": "Calliope mini 2.x",
"url":"_7YbU6iMhoTdR",
"description": "The Calliope mini 2.0 and newer has a larger memory than the previous versions. If you use this template for your project, you can make the most of all the features on your Calliope mini!",
"imageUrl": "/calliope/templates/32KB.png",
"largeImageUrl": "/calliope/templates/32KB_L.png",
"cardType": "sharedExample",
"buttonLabel": "New project"
},{
"name": "Calliope mini 1.x",
"url":"_7YbU6iMhoTdR",
"description": "This template is designed for all Calliope mini, but especially for those up to version 1.3. If you have such a Calliope mini or an earlier version, you can start directly with this template.",
"imageUrl": "/calliope/templates/16KB.png",
"largeImageUrl": "/calliope/templates/16KB_L.png",
"cardType": "sharedExample",
"buttonLabel": "New project"
}
]
```
6 changes: 6 additions & 0 deletions docs/calliope/templates/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Boards

* [Calliope](/boards/calliope)
* [Calliope mini Ref. 1.x](/boards/calliope-mini-v1)
* [Calliope mini Ref. 2](/boards/calliope-mini-v2)

12 changes: 12 additions & 0 deletions docs/calliope/templates/calliope-mini-1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Calliope mini v1

```blocks
basic.showString("Hi!")
basic.forever(function () {
})
```

```package
core
```
12 changes: 12 additions & 0 deletions docs/calliope/templates/calliope-mini-2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Calliope mini v2

```blocks
basic.showString("Hi!")
basic.forever(function () {
})
```

```package
mini2
```
Binary file added docs/calliope/templates/info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/calliope/templates/info_L.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions docs/calliope/templates/templates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Calliope

## mini

### ~ codecard

* name: Calliope mini 2.x
* url: /calliope/templates/calliope-mini-2
* cardType: template
* imageUrl: /calliope/templates/32KB.png
* description: Project template for all Calliope mini 2.x

---

* name: Calliope mini 1.x
* url: /calliope/templates/calliope-mini-1
* cardType: template
* imageUrl: /calliope/templates/16KB.png
* description: Project template for all Calliope mini 1.x

---

* name: Which template?
* url: /calliope/neu
* imageUrl: /calliope/templates/info.png
* description: Not sure which template is right for you? Here you will find the necessary information.

### ~
2 changes: 1 addition & 1 deletion docs/device/data-analysis/led-plotting.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ for (let i = 0; i < values.length; i++) {
The ``||led:plot bar graph||`` also sends the number value it's plotting to the console. You can see the output in the Data Viewer. It charts the values and they appear as individual numbers in console.

```blocks
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.B, input.buttonEventClick(), function () {
for (let i = 0; i < 25; i++) {
if (i % 2 > 0) {
led.plotBarGraph(0, 0)
Expand Down
10 changes: 5 additions & 5 deletions docs/device/simulator.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ The JavaScript simulator allows you to test and execute most BBC micro:bit progr
It allows you to emulate sensor data or user interactions.

```sim
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.A, input.buttonEventClick(), function () {
basic.showString("A");
});
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.B, input.buttonEventClick(), function () {
basic.showString("B");
});
input.onPinTouchEvent(TouchPin.P0, input.buttonEventValue(ButtonEvent.Click), () => {
input.onPinTouchEvent(TouchPin.P0, input.buttonEventClick(), function () {
basic.showString("0");
});
input.onPinTouchEvent(TouchPin.P1, input.buttonEventValue(ButtonEvent.Click), () => {
input.onPinTouchEvent(TouchPin.P1, input.buttonEventClick(), function () {
basic.showString("1");
});
input.onPinTouchEvent(TouchPin.P2, input.buttonEventValue(ButtonEvent.Click), () => {
input.onPinTouchEvent(TouchPin.P2, input.buttonEventClick(), function () {
basic.showString("2");
});
input.temperature()
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/gameofLife.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ Here's a program that simulates cell life in the LED matrix. Use button ``A`` fo
let lifeChart: Image = null

//Use button A for the next iteration of game of life
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.A, input.buttonEventClick(), function () {
gameOfLife();
show();
})

//Use button B for reseting to random initial seed state
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.B, input.buttonEventClick(), function () {
reset();
show();
})
Expand Down
18 changes: 12 additions & 6 deletions docs/projects.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
```codecard
[
{
"name": "New Project (iPad)",
"url": "/calliope/templates",
"imageUrl": "/calliope/templates/32KB.png",
"largeImageUrl": "/calliope/templates/32KB_L.png"
"name": "New project templates",
"url": "/calliope/templates/templates",
"imageUrl": "/calliope/templates/32KB.png"
},
{
"name": "First Steps",
Expand All @@ -23,14 +22,21 @@
"name": "Calliope Links",
"url": "/calliope/links",
"imageUrl": "/calliope/links/thumbnail_shop.gif"
},
{
"name": "New Project (iPad)",
"url": "/calliope/templates",
"imageUrl": "/calliope/templates/32KB.png",
"largeImageUrl": "/calliope/templates/32KB_L.png"
}
]
```

## See Also

[New Project (iPad)](/calliope/templates),
[New project templates](/calliope/templates/templates),
[First Steps](/calliope/firststeps),
[Tutorials](/calliope/tutorials),
[Calliope Links](/calliope/links)
[Calliope Links](/calliope/links),
[New Project (iPad)](/calliope/templates)

10 changes: 7 additions & 3 deletions docs/projects/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Projects

* [New Project (iPad)](/calliope/templates)
* [Calliope mini 2.x](_f7ACuxgaocvr)
* [Calliope mini 1.x](_7YbU6iMhoTdR)
* [New project templates](/calliope/templates/templates)
* [Calliope mini 2.x](/calliope/templates/calliope-mini-2)
* [Calliope mini 1.x](/calliope/templates/calliope-mini-1)
* [Which template?](/calliope/neu)
* [First Steps](/calliope/firststeps)
* [Get Ready](/calliope/firststeps/firstSteps)
* [The 5x5 LED matrix](/calliope/firststeps/5x5LED)
Expand Down Expand Up @@ -30,3 +31,6 @@
* [Projects](https://calliope.cc/en/projekte)
* [Teaching materials](https://calliope.cc/schulen/schulmaterial)
* [Forum](https://forum.calliope.cc)
* [New Project (iPad)](/calliope/templates)
* [Calliope mini 2.x](/boards/calliope-mini-v2)
* [Calliope mini 1.x](/calliope/templates/calliope-mini-1)
8 changes: 4 additions & 4 deletions docs/projects/coin-flipper.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Let's create a coin flipping program to simulate a real coin toss. We'll use ico
Get an ``||input:on button A pressed||`` block from the ``||input:Input||`` drawer in the toolbox. We'll put our coin flipping code in here.

```blocks
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.A, input.buttonEventClick(), function () {
})
```

Expand All @@ -22,7 +22,7 @@ Grab an ``||logic:if else||`` block and set it inside ``||input:on button A pres
The ``||Math:pick random true or false||`` returns a random ``true`` or ``false`` value which we use to determine a ``heads`` or ``tails`` result for a coin toss.

```blocks
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.A, input.buttonEventClick(), function () {
if (Math.randomBoolean()) {
} else {
}
Expand All @@ -34,7 +34,7 @@ input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
Now, put a ``||basic:show icon||`` block inside both the ``||logic:if||`` and the ``||logic:else||``. Pick images to mean ``heads`` and ``tails``.

```blocks
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.A, input.buttonEventClick(), function () {
if (Math.randomBoolean()) {
basic.showIcon(IconNames.Skull)
} else {
Expand All @@ -52,7 +52,7 @@ Press button **A** in the simulator to try the coin toss code.
You can animate the coin toss to add the feeling of suspense. Place different ``||basic:show icon||`` blocks before the ``||logic:if||`` to show that the coin is flipping.

```blocks
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.A, input.buttonEventClick(), function () {
basic.showIcon(IconNames.Diamond)
basic.showIcon(IconNames.SmallDiamond)
basic.showIcon(IconNames.Diamond)
Expand Down
8 changes: 4 additions & 4 deletions docs/projects/smiley-buttons.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Code the buttons on the @boardname@ to show that it's happy or sad.
Place a ``||input:on button pressed||`` block to run code when button **A** is pressed.

```blocks
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.A, input.buttonEventClick(), function () {
});
```

Expand All @@ -21,7 +21,7 @@ input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
Place a ``||basic:show leds||`` block inside ``||input:on button pressed||`` to display a smiley on the screen. Press the **A** button in the simulator to see the smiley.

```blocks
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.A, input.buttonEventClick(), function () {
basic.showLeds(`
# # . # #
# # . # #
Expand All @@ -37,7 +37,7 @@ input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
Add ``||input:on button pressed||`` and ``||basic:show leds||`` blocks to display a frowny when button **B** is pressed.

```blocks
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.B, input.buttonEventClick(), function () {
basic.showLeds(`
# # . # #
# # . # #
Expand All @@ -53,7 +53,7 @@ input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
Add a secret mode that happens when **A** and **B** are pressed together. For this case, add multiple ``||basic:show leds||`` blocks to create an animation.

```blocks
input.onButtonEvent(Button.AB, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.AB, input.buttonEventClick(), function () {
basic.showLeds(`
. . . . .
# . # . .
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ basic.showString("Micro!")
Well, the text stopped scrolling. Place the ``||basic:show string||`` block in the ``||input:on button pressed||`` slot to scroll your name when button **A** is pressed.

```blocks
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.A, input.buttonEventClick(), function () {
basic.showString("Micro!")
});
```
Expand All @@ -25,7 +25,7 @@ Place some blocks to display a smiley when button **B** is pressed.
Use the dropdown to find ``B``!

```blocks
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.B, input.buttonEventClick(), function () {
basic.showLeds(`
# # . # #
# # . # #
Expand Down
6 changes: 3 additions & 3 deletions docs/tutorials/hour-of-code/hey-microbit.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ basic.showString("My Name")
Well, you noticed that the text stopped. Place the ``||basic:show string||`` block in an ``||input:on button pressed||`` block to scroll your name whenever button **A** is pressed.

```block
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.A, input.buttonEventClick(), function () {
basic.showString("My Name")
});
```
Expand All @@ -23,7 +23,7 @@ input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
Ok, let's try to talk to the @boardname@ using a button. Change the text in ``||basic:show string||`` to ask the question "How are you?". Add another ``||basic:show string||`` with "....." to show that the @boardname@ is thinking.

```block
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.A, input.buttonEventClick(), function () {
basic.showString("How are you?")
basic.showString(".....");
})
Expand All @@ -34,7 +34,7 @@ input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
Now, make the @boardname@ give an answer with a smiley face! Find the ``||basic:show leds||`` and draw a smiley face on the block by clicking on the LEDs. Press button **A** in the simulator and see the @boardname@ respond to your question.

```block
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.A, input.buttonEventClick(), function () {
basic.showString("How are you?")
basic.showString(".....");
basic.showLeds(`
Expand Down
8 changes: 4 additions & 4 deletions docs/types/buffer/using-buffers.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ You could simply save the light measurements in an array like this:

```blocks
let darkness: number[] = []
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.A, input.buttonEventClick(), function () {
for (let i = 0; i < 60 * 4; i++) {
darkness.push(input.lightLevel())
basic.pause(60000)
Expand All @@ -77,7 +77,7 @@ The code in blocks for recording the light level is modified to make our file da

```typescript-ignore
let darkness = pins.createBuffer(60 * 4);
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.A, input.buttonEventClick(), function () {
for (let i = 0; i < 60 * 4; i++) {
darkness.setNumber(NumberFormat.UInt8LE, i, input.lightLevel())
basic.pause(60000)
Expand All @@ -90,15 +90,15 @@ Later, we can upload the file to the laptop computer by pressing the **B** butto
```typescript-ignore
let dataReady = false;
let darkness = pins.createBuffer(60 * 4);
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.A, input.buttonEventClick(), function () {
for (let i = 0; i < 60 * 4; i++) {
darkness.setNumber(NumberFormat.UInt8LE, i, input.lightLevel())
basic.pause(60000)
}
dataReady = true;
})
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.B, input.buttonEventClick(), function () {
if (dataReady) {
serial.writeLine("Transferring file: DARKNESS, Length: " + darkness.length + " bytes...");
serial.writeBuffer(darkness)
Expand Down
Loading

0 comments on commit ceeeaef

Please sign in to comment.