Cover image
    Activity

    Code a micro:bit to Shake

    Make a jittering motion for a servo.

    Coding
    Get Started
    8-14+
    40:00
    micro:bit Coding Cards

    Code

    Shake

    00:10

    Repeatedly set the Servo A position to a random value.

    basic.forever(function () {
        sb.setServoPosition(sb.servo(SBServo.ServoA), Math.randomRange(0, 100))
    })

    If using micro:bit for the first time, follow this setup.