Skip to content

Commit be4a5b2

Browse files
committed
add display shield info
1 parent a1d98af commit be4a5b2

8 files changed

Lines changed: 48 additions & 37 deletions

File tree

.astro/content-modules.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ export default new Map([
66
["src/content/docs/apps/microbit-robot.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Fdocs%2Fapps%2Fmicrobit-robot.mdx&astroContentModuleFlag=true")],
77
["src/content/docs/apps/microdata.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Fdocs%2Fapps%2Fmicrodata.mdx&astroContentModuleFlag=true")],
88
["src/content/docs/extensions/display-shield-ext.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Fdocs%2Fextensions%2Fdisplay-shield-ext.mdx&astroContentModuleFlag=true")],
9-
["src/content/docs/getting-started/display-shields.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Fdocs%2Fgetting-started%2Fdisplay-shields.mdx&astroContentModuleFlag=true")],
109
["src/content/docs/getting-started/intro.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Fdocs%2Fgetting-started%2Fintro.mdx&astroContentModuleFlag=true")],
10+
["src/content/docs/getting-started/display-shields.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Fdocs%2Fgetting-started%2Fdisplay-shields.mdx&astroContentModuleFlag=true")],
1111
["src/content/docs/resources/docs.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Fdocs%2Fresources%2Fdocs.mdx&astroContentModuleFlag=true")],
1212
["src/content/docs/resources/api.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Fdocs%2Fresources%2Fapi.mdx&astroContentModuleFlag=true")],
1313
["src/content/docs/resources/tutorials.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Fdocs%2Fresources%2Ftutorials.mdx&astroContentModuleFlag=true")]]);

.astro/data-store.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

astro.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default defineConfig({
3737
label: "Getting Started",
3838
items: [
3939
{ label: "What is the BBC Micro:bit?", link: "/getting-started/intro/" },
40-
{ label: "Display shield overview", link: "/getting-started/display-shields/" },
40+
{ label: "Display shields", link: "/getting-started/display-shields/" },
4141
],
4242
},
4343
{

src/assets/extension-dialog.png

1.5 MB
Loading

src/assets/mbit-front-back.png

236 KB
Loading

src/content/docs/extensions/display-shield-ext.mdx

Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,55 @@ title: Display Shield
33
description: Create stunning visual displays with your micro:bit
44
---
55

6-
The Display Shield is a powerful graphics library and toolkit for creating beautiful visual effects on your micro:bit.
6+
The [MakeCode display shield extension](https://makecode.microbit.org/pkg/microbit-apps/display-shield) allows you to use any of the MakeCode Arcade shields with the [MakeCode for the micro:bit](https://makecode.microbit.org) or [MakeCode for Calliope](https://makecode.calliope.cc/) editors.
77

88
## Features
99

10-
- **Rich Graphics**: Render images, text, and animations
11-
- **Multiple Pixel Modes**: Support for different color depths and display modes
12-
- **Animation Support**: Create smooth, frame-based animations
13-
- **Easy API**: Simple yet powerful functions for drawing shapes and text
14-
- **Performance Optimized**: Efficient rendering for smooth gameplay
10+
- **simulator support**
11+
- access to the color display and buttons on the shield
12+
- Bitmap abstraction with numerous drawing primitives (draw line, circle, square, etc)
13+
- Bitmaps also can be created using the built-in image editor in MakeCode
1514

1615
## Getting Started
1716

18-
1. Import the Display Shield library in your micro:bit project
19-
2. Initialize the display with your preferred settings
20-
3. Start drawing shapes, text, and images
21-
4. Create interactive graphics with sprite support
22-
23-
## Example Code
24-
25-
```python
26-
from display_shield import *
27-
28-
# Create a display
29-
display = Display()
30-
31-
# Draw a rectangle
32-
display.draw_rect(2, 2, 1, 1, color=True)
33-
34-
# Show the display
35-
display.show()
17+
- Open https://makecode.microbit.org/
18+
- Create a new project
19+
- Add an extension via the “Extensions” item in the gear wheel (upper right)
20+
- Click the “Lights and Display” button, as shown below
21+
- Select the display shield extension, as shown below
22+
23+
![extension dialog](../../../assets/extension-dialog.png)
24+
25+
## Plot the accelerometer values as time series
26+
27+
Copy this program into the JavaScript editor to plot the
28+
instantaneous values of the micro:bit's 3-axis accelerometer
29+
on the display shield screen:
30+
31+
```javascript
32+
let x = 0, old_x = 0
33+
let y = 0, old_y = 0
34+
let z = 0, old_z = 0
35+
let t = 0
36+
basic.forever(function () {
37+
x = Math.map(input.acceleration(Dimension.X), -1024, 1024, 120, 0)
38+
y = Math.map(input.acceleration(Dimension.Y), -1024, 1024, 120, 0)
39+
z = Math.map(input.acceleration(Dimension.Z), -1024, 1024, 120, 0)
40+
screen().drawLine(t, x, t - 1, old_x, 3)
41+
screen().drawLine(t, y, t - 1, old_y, 4)
42+
screen().drawLine(t, z, t - 1, old_z, 5)
43+
t = t + 1
44+
if (t == 160) {
45+
screen().scroll(-1, 0)
46+
t = 159
47+
}
48+
old_x = x
49+
old_y = y
50+
old_z = z
51+
})
3652
```
3753

38-
## Documentation
39-
40-
For detailed API documentation and more examples, check out the [Display Shield repository](https://github.com/microbit-apps/display-shield).
41-
4254
## Learn More
4355

44-
- [Tutorials](/resources/tutorials/)
45-
- [API Reference](/resources/api/)
56+
- [API reference and examples](https://makecode.microbit.org/pkg/microbit-apps/display-shield)
4657
- [GitHub Repository](https://github.com/microbit-apps/display-shield)

src/content/docs/getting-started/display-shields.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
title: Display Shield Overview
3-
description: Learn about the display shields for the BBC micro:bit
2+
title: Display Shields for the micro:bit
3+
description: Learn about the display shields for the micro:bit
44
---
55

6-
There are a variety of display shields available for the BBC micro:bit
6+
There are a variety of display shields available for the BBC micro:bit (version 2)
77
that enhance its capabilities by providing a color display and additional
88
buttons. The microbit slots into the shield using its edge connector.
99
The display shields have a variety of uses:

src/content/docs/getting-started/intro.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The [BBC micro:bit](https://microbit.org/) is a small, programmable microcompute
77
designed to help you learn how computers work. It's perfect
88
for beginners and experienced programmers alike.
99

10-
![BBC micro:bit](../../../assets/mbit-v2.png)
10+
![BBC micro:bit](../../../assets/mbit-front-back.png)
1111

1212
## Key Features
1313

0 commit comments

Comments
 (0)