Anish Ansari
Published © GPL3+

How to Control Mini Servo Using BBC Micro:bit

At the end of this article, you will have complete knowledge of how you can control a mini servo using a BBC micro:bit.

EasyFull instructions provided30 minutes1,304

Things used in this project

Hardware components

BBC micro:bit board
BBC micro:bit board
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
×1
AA Batteries
AA Batteries
×2
Male/Male Jumper Wires
×3
Servo (generic)
×1

Software apps and online services

pxt.microbit.org
micro:bit pxt.microbit.org
MakeCode
Microsoft MakeCode
Microsoft MakeCode for MICRO:BIT

Story

Read more

Code

Javascript code

JavaScript
basic.forever(() => {  
    while (true) {  
        pins.servoWritePin(AnalogPin.P0, 45)  
        basic.pause(1000)  
        pins.servoWritePin(AnalogPin.P0, 90)  
        basic.pause(1000)  
        pins.servoWritePin(AnalogPin.P0, 180)  
        basic.pause(1000)  
    }  
})  

Credits

Anish Ansari

Anish Ansari

11 projects • 15 followers
Azure and IoT
Contact

Comments

Add projectSign up / LoginAbout BBC micro:bit