facebook.png

ETC

ftcommunity.png

© Želimir Bistrović 2019

PROGRAMMING SCHOOL

Programming micro:bit in Python (Mu)

ENCODER MOTOR - COUNTER CONTROL

VJ: 019

spajanje19_mb.jpgmicrobit019.jpg
WIRING:
Connect encoder motor to OUTPUT for motor M1 (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 sleep.
DOWNLOAD:vjezba19.zip

Controling LEDs with Potentiometer

VJ: 013

spajanje13_mb.jpgmicrobit013.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:vjezba13.zip

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

VJ: 011

spajanje11_mb.jpgmicrobit011.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:vjezba11.zip

COLOR SENZOR (FischerTechnik) - COLOR recognition

VJ: 010

spajanje10_mb.jpgmicrobit010.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 BATTERY connector (9V). 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:vjezba10.zip

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

VJ: 009

spajanje09_mb.jpgmicrobit009.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 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:vjezba09.zip

LIGHT CONNTROL - POTO sensor (ANALOGUE)

VJ: 008

spajanje08_mb.jpgmicrobit008.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:vjezba08.zip

LIGHT CONTROLL - POTO sensor (DIGITALLY) B

VJ: 007

spajanje07_mb.jpgmicrobit007.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:vjezba07.zip

LIGHT CONTROLL - POTO sensor (DIGITALLY) 2

VJ: 006

spajanje06_mb.jpgmicrobit006.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:vjezba06.zip

LIGHT CONTROLL - POTO sensor (DIGITALLY)

VJ: 005

spajanje05_mb.jpgmicrobit005.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:vjezba05.zip

LIGHT CONTROLL - PUSH BUTTON (DIGITALNO)

VJ: 004

spajanje04_mb.jpgmicrobit004.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.
DOWNLOAD:vjezba04.zip

TWO LIGHTS CONTROLL WITH BUTTONS A AND B

VJ: 003

spajanje03_mb.jpgmicrobit003.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:vjezba03.zip

TWO LIGHTS CONTROLL

VJ: 002

spajanje02_mb.jpgmicrobit002.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:vjezba02.zip

LIGHT / LED CONTROLL

VJ: 001

spajanje01_mb.jpgmicrobit001.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:vjezba01.zip