BhavithiranSuad AnwarSC Lim
Published © MIT

EDU:BIT Object Counter With Mini Conveyor | MicroPython

Guide to program Object Counter With Mini Conveyor with EDU:BIT (project kit for micro:bit) using MicroPython

BeginnerFull instructions provided30 minutes642
EDU:BIT Object Counter With Mini Conveyor | MicroPython

Things used in this project

Hardware components

EDU:BIT
Cytron Technologies EDU:BIT
×1

Software apps and online services

Mu
Python Editor for micro:bit

Story

Read more

Code

Object Counter With Mini Conveyor

Python
This tutorial's full code
from edubit import *
import music                                    # import music module

count = 0                                       # set 'count' variable to 0
while True:
    init()                                      # initialize EDU:BIT
    if is_IR_sensor_triggered():                # IR sensor triggered
        count += 1                                
        music.play(music.BA_DING)               # play melody
    if button_a.is_pressed():                   # button A pressed
        run_motor(M1,Forward, speed=200)        # run motor M1 at speed 200
        set_led(Red, 0)
        set_led(Green, 1)                       # turn on green led
    if button_b.is_pressed():                   # button B pressed
        brake_motor(M1)                         # brakes motor
        set_led(Red, 1)                         # turn on red led
        set_led(Green, 0)
        count = 0
    display.show(count)                         # show count value in microbit display

Credits

Bhavithiran
16 projects • 7 followers
Contact
Suad Anwar
1 project • 2 followers
Contact
SC Lim
13 projects • 13 followers
Husband · Dad | Loves tinkering & making
Contact

Comments

Please log in or sign up to comment.