facebook.png

ETC

ftcommunity.png

© Želimir Bistrović 2019

PROGRAMMING SCHOOL

Programming micro:bit in Blocks

ULTRASOUND SENSOR (3.3V) - random car control

VJ: 020

spajanje20_mb.jpgmicrobitB020.jpg
WIRING:
Connect the ULTRASONIC sensor to the 3.3V supply (red and green). Connect the signal wires to the input P0 (blue) and P3 (black). Connect the right motor to the motor outputs M1 (P15 and P16), and the left at the motor outputs M2 (P13 and P14). ADD package "SONAR".
PROGRAM TASK:
When the ULTRASONIC sensor finds an obstacle, the vehicle should go back for a certain time (500 ms). The RANDOM decision requires the program to select the direction of the vehicle. After the vehicle moves to the chosen side, it moves forward again.
DOWNLOAD:microbit-v20.zip

ENCODER MOTOR - COUNTER CONTROL

VJ: 019

spajanje19_mb.jpgmicrobitB019.jpg
WIRING:
Connect encoder motor to OUTPUTS P15 and P16. Counter supply ( green and red wire ) connect to 5V output. Signal wire connect to INPUT P1.
PROGRAM TASK:
When you press button A, motor starts to rotate. Motor stop to rotate after counter count 23 steps (inpulses). When you pres button B, motor start tu rotate with slower speed. Motor stop to rotate after counter count 76 steps (inpulses). To regulate speed use pause.
DOWNLOAD:microbit-v19.zip

ULTRASONIC SENSOR DISTANCE MEASUREMENT - value display

VJ: 015

spajanje15_mb.jpgmicrobitB015.jpg
WIRING:
Measuring distance by ultrasonic sensor with results display in the form of values, on the micro: bit screen. You need package "SONAR".
PROGRAM TASK:
DOWNLOAD:microbit-v15.zip

ULTRASONIC SENSOR DISTANCE MEASUREMENT - View as GRAPH

VJ: 014

spajanje14_mb.jpgmicrobitB014.jpg
WIRING:
Ultrasound sensor distance measurement with bar graph display on micro:bits screen. You need package "SONAR".
PROGRAM TASK:
DOWNLOAD:microbit-v14.zip

Controling LEDs with Potentiometer

VJ: 013

spajanje13_mb.jpg 	microbitB013.jpg
WIRING:
Turning the potentiometer turns on the LEDs. The potentiometer is connected to INPUT P0 and reads analogously. The interface is powered by a universal 5V adapter.
PROGRAM TASK:
DOWNLOAD:microbit-v13.zip

SERVO MOTOR

VJ: 012

spajanje12_mb.jpgmicrobitB012.jpg
WIRING:
Connect servo (4.8 - 6V) to 5V supply and signal wire to INPUT P0.
PROGRAM TASK:
DOWNLOAD:microbit-v12.zip

MOTOR - ROTATION CONTROL WITH BUTTONS "A" AND "B"

VJ: 011

spajanje11_mb.jpgmicrobitB011.jpg
WIRING:
Connect motor on OUTPUTS 1 i 2 (P16 i P15).
PROGRAM TASK:
When you press the "A" button on the interface, the propeller must start to rotate in direction A, and when press the "B" button in direction B. Directions A and B depend on the motor connection (polarity).
DOWNLOAD:microbit-v11.zip

COLOR SENZOR (FischerTechnik) - COLOR recognition

VJ: 010

spajanje10_mb.jpgmicrobitB010.jpg
WIRING:
Connect the RED light to OUT 1 (P16), GREEN to OUTPUT 2 (P15), ON to OUT 3 (P14), and COLOR sensor to input 1 (P1). Connect the sensor power to the OUTPUT P8. Add "digital write pin P8 to 1" on start after "led enable". Use the analogue reading of the input value in the program. Set the program's operation according to the Input Readings for color matching.
PROGRAM TASK:
When the COLOR sensor read value for BLACK color, the RED lamp should light. When the COLOR sensor is oread value for GREEN color, the GREEN lamp should light, and when the WHITE color value read (background),WHITE light should light.
DOWNLOAD:microbit-v10.zip

LIGHT CONTROLL - POTO sensor (ANALOGUE) - RECOGNIZING BLACK LINE

VJ: 009

spajanje09_mb.jpgmicrobitB009.jpg
WIRING:
Connect the RED lamp to OUT 1 (P16), and the PHOTO sensor to input 1 (P1). Use the analogue reading of the input value in the program. Base should be illuminated. You can do a test by turning the sensor towards the light.
PROGRAM TASK:
When the PHOTO sensor illuminated (WHITE BACKGROUND) light should be ON. When NOT illuminated (BLACK BACKGROUND), the light bulb needs to be OFF. Set the query values (IF) in the program according to your readings.
DOWNLOAD:microbit-v09.zip

LIGHT CONNTROL - POTO sensor (ANALOGUE)

VJ: 008

spajanje08_mb.jpgmicrobitB008.jpg
WIRING:
Connect the RED lamp to OUT 1 (P16), and the PHOTO sensor to input 1 (P1). Use the analogue reading of the input value in the program.
PROGRAM TASK:
When the PHOTO sensor is illuminated, the light should be ON. When NOT illuminated, the light should be OFF.
DOWNLOAD:microbit-v08.zip

LIGHT CONTROLL - MAGNETIC sensor (DIGITALLY) 4

VJ: 007

spajanje07_mb.jpgmicrobitB007.jpg
WIRING:
Connect the RED lamp to OUT 1 (P16), and the PHOTO sensor to input 1 (P1). Use the digital reading.
PROGRAM TASK:
When the MAGNETIC sensor is near magnet lamp needs to be ON, and when NOT the lamp needs to be OFF.
DOWNLOAD:microbit-v07.zip

LIGHT CONTROLL - POTO sensor (DIGITALLY) 3

VJ: 006

spajanje06_mb.jpgmicrobitB006.jpg
WIRING:
Connect the RED lamp to OUT 1 (P16), and the PHOTO sensor to input 1 (P1). Use the digital reading.
PROGRAM TASK:
When the PHOTO sensor is illuminated, the light should be ON. When NOT illuminated, the light should be OFF.
DOWNLOAD:microbit-v06.zip

LIGHT CONTROLL - POTO sensor (DIGITALLY) 2

VJ: 005

spajanje05_mb.jpgmicrobitB005.jpg
WIRING:
Connect the RED lamp to OUT 1 (P16), and the PHOTO sensor to input 1 (P1). Use the digital reading.
PROGRAM TASK:
When the PHOTO sensor is illuminated, the light should be ON for 50 miliseconds. When NOT illuminated, the light should be OFF.
DOWNLOAD:microbit-v05.zip

LIGHT CONTROLL - PUSH BUTTON (DIGITALLY)

VJ: 004

spajanje04_mb.jpgmicrobitB004.jpg
WIRING:
Connect the RED lamp to OUT 1 (P16), and PUSH BUTTON to the input 1 (P1).
PROGRAM TASK:
The RED lamp must be ON when the button is pressed for 50 miliseconds.
DOWNLOAD:microbit-v04.zip

TWO LIGHTS CONTROLL WITH BUTTONS A AND B

VJ: 003

spajanje03_mb.jpgmicrobitB003.jpg
WIRING:
Connect the RED lamp to OUT 1 (P16), and GREEN to OUTPUT 2 (P15).
PROGRAM TASK:
Turn on the RED light for 0.5 seconds by pressing button "B" on the interface. Turn on the green light for 0.5 seconds by pressing "A" button on the interface.
DOWNLOAD:microbit-v03.zip

TWO LIGHTS CONTROLL

VJ: 002

spajanje02_mb.jpgmicrobitB002.jpg
WIRING:
Connect the RED lamp to OUT 1 (P16), and GREEN to OUTPUT 2 (P15).
PROGRAM TASK:
Turn ON the RED light for 0.5 seconds. Turn OFF RED light for 0.5 seconds. Turn ON the GREEN light for 0.5 seconds. Turn OFF GREEN light for 0.5 seconds.
DOWNLOAD:microbit-v02.zip

LIGHT / LED CONTROLL

VJ: 001

spajanje01_mb.jpgmicrobitB001.jpg
WIRING:
Connect the light to OUT 1 (P16).
PROGRAM TASK:
Turn ON the light for 0.5 seconds. Turn OFF the light for 0.5 seconds. Repeat.
DOWNLOAD:microbit-v01.zip