BBC Microbit
- Introduction
- Buzzer With MicroPython
- LEDs With MicroPython
- Connecting micro:bits Together
- Extra Buttons
- Knock Sensor
- Rotary Encoder
- Rotary Encoder Class
- Potentiometer
- Soft Potentiometer
- Flex Sensor
- Tilt Sensor
- Reed Switch
- More Buttons
- Temperature Sensor
- 7 Segment Display
- Reflectance Sensor
- Driving A Motor
- Shift Register
- Shifting In
- Neopixels
- IR Break Beam Sensor
- DIY MIDI Out
- PCF8574A Port Expander
- 16x2 Character LCD Display
- SNES Controller
- MCP23017 Port Expander
- Nokia 5110 LCD
- Bluetooth Mouse & Keyboard
- VS1053 Codec Breakout - MIDI
- Dot/Bar Graph LED Driver
- Wii Nunchuck Controller
- PS3 Dualshock Controller
- MPR121 Capacitive Touch
- IS31FL3731 LED Matrix Driver
- Adafruit I2C FRAM
- Sparkfun moto:bit
- Multiplexer 74HC4051
- PIR Motion Sensor
- Real Time Clock
- USB Keyboard
- Water Sensor
- Vkey Voltage Keypad
- 16x2 Serial LCD
- HT16K33 7-Segment Display
- Piano For micro:bit
- MAX7219 LED Matrix
- McRoboFace
- MPRLS Pressure Sensor
- Cube:Bit RGB LED Cube
- Kitronik RTC Board
- Ultrasonic Distance HC-SR04
- Qwiic MP3 Trigger
- Kitronik LAB:bit
- RFID Accessory
- Steady Hands
- Feline Detection System
- Play-Doh Touch Buttons
- Noise Maker
- Simon Game
- Pedestrian Crossing
- LCD Digital Clock
- Binary Clock
- DIY Robot Vehicle
- IS31FL3731 Digital Clock
- SN3218 Binary Clock
- Radio Message Sender & Scroller
- Noughts & Crosses
- Four Letter Clock
- Neopixel Ring Clock
- Scroll:bit Clock
- Speaking Clock
- Happy Clappy McRoboFace
- Touch:bit Noise:bit Simon
BBC micro:bit
Driving A Motor
Introduction
Circuit
In this circuit you have,
- Motor
- 470 Ohm Resistor
- NPN transistor
- Diode 1N4148
Program
We'll turn the motor on when the A button is pressed, otherwise we'll switch it off.
from microbit import * while True: if button_a.is_pressed(): pin0.write_digital(1) else: pin0.write_digital(0) sleep(50)
Challenge
Stick to the single motor and go easy when using this much power from the micro:bit. Make a spinning circle out of card and place it on the axle of the motor. Use this in a game, as a pretty colour wheel or as a nice little fan.