PROGRAMMING SCHOOL
Programming micro:bit AD in Python
1. Silent Night7. GAME - SIMPLE EXAMPLE (Python)
2. PHOTO SENSORS - VALUES DISPLAY (Python)8. GRAPHICS FUNCTIONS (Python)
3. PHOTO SENSOR - BAR GRAPH VALUES (Python)9. GAME - METEORS (Python)
4. SWITCH STATUS (Python)10. GAME - LABIRINTH (Python)
5. micro:bit AD + micro:bit IO F5 - I2C communication (Python)11. PLATFORM GAME (Python)
6. GRAPHIC FUNCTIONS IN APPLICATION - COMPASS (Python)12. TEXT FUNCTIONS (Python)

Silent NightTOP
24.jpg

Musical greeting card.

PHOTO SENSORS - VALUES DISPLAY (Python)TOP
23.jpg

The display of the analog values of the read sensors can also be displayed in several ways. One is a display in text form.

PHOTO SENSOR - BAR GRAPH VALUES (Python)TOP
22.jpg

The display of analog values of read sensors can be displayed in several graphical ways. The example shows the read values in the form of a 2D graph.

SWITCH STATUS (Python)TOP
21.jpg

One way to display the status of a button or other sensor, with a digital value reading, is a text status display. It is also possible to display graphically.

micro:bit AD + micro:bit IO F5 - I2C communication (Python)TOP
20.jpg

Micro:bit AD can be used to display values in combination with other interfaces that allow I2C (3.3V) communication. The interface shown is a micro:bit IO F5 that has a connector for I2C (3.3V) communication. The F5 interface simultaneously powers the micro:bit AD via the 5V power connector.

GRAPHIC FUNCTIONS IN APPLICATION - COMPASS (Python)TOP
19.jpg

To display the data obtained from the compass, we used the functions to draw a circle, a filled circle, and a line.

GAME - SIMPLE EXAMPLE (Python)TOP
16.jpg

This game does not use the scroll function to move objects. Objects are displayed on the screen and do not change position. Objects with functions that affect the player object are used. In addition to the previously displayed objects, a new object with the DOOR function is used. By passing through the DOOR, the player object appears at the starting position and the complete screen is displayed again. TOUCH sensors are also used for additional controls of the player object. Standard functions are used to draw lines. Other standard features for drawing or printing text can be used to create the screen.

GRAPHICS FUNCTIONS (Python)TOP
15.jpg

The demo shows functions for drawing lines, circles, rectangles, pixels in combination with scroll functions. Scroll functions allow you to display data in GRAPH format or simple animation. Combinations of scroll functions with graphic objects can best be seen in demo examples of games.

GAME - METEORS (Python)TOP
13.jpg

As in the previous game, it is necessary to define the appearance of the "screen" and the position of the objects on the screen. In this game we do not have platforms but objects that collide with the player's object (aircraft). In addition to objects with function (2,3), the game also uses an object that does not change the result of the game directly, but affects the position of the player's object.

GAME - LABIRINTH (Python)TOP
12.jpg

A game that contains all the basic functions for making a game and all four directions of player object control. In previous games, sound effects appear in different situations in the game. Sound effects are used to gain points, loss of life and drop out off screen (loss of life). Sound effects can be created as desired.

PLATFORM GAME (Python)TOP
11.jpg

When creating a platform game, it is necessary to define certain parameters of the game. In order for the game to be interesting, it is necessary to create graphic objects that have a certain function. In addition to the player object (9), it is necessary to create an object that will bring points to the player (2), and an object that will take the life (3). In platform games, it is necessary to create platforms on which the player's object moves. The OBJ function allows you to create one or more "screens" with the positions of different objects. The display of these "screens" on the screen is performed sequentially and in a circle. In addition to creating graphical objects (bitmaps), it is necessary to define the operation of functions that control the movement of the player's object. One of the functions is GRAVITY. Setting the gravity parameter to 1 turns on the function that controls the player's object to fall, if it is not on the platform. If the PAD (1) function is on, the player object reappears at the initial position after falling off the screen, and if the PAD is off, the player object will appear at the top position of the screen. In addition, if the game is to be scored, it is necessary to turn on the BOD function with the initial state (0). The LIV function is used to assign the initial number of lives. This is just a brief description of some of the features used in this demo game.

TEXT FUNCTIONS (Python)TOP
10.jpg

The demo program shows the functions that work with printing and text control. The functions of printing text of different sizes in standard and graphic mode are shown. Standard mode uses text screen resolution (14x6) and graphical graphic resolution (84x48). In addition to printing, text manipulation functions are displayed.