Smart Creativity
Created August 2, 2020 © CC BY

Make an Otto Diy dancing robot without 3d printer

How to make an otto diy dancing robot without 3D printer.

IntermediateFull instructions provided2 hours1

Things used in this project

Hardware components

Circuit Playground Express
Adafruit Circuit Playground Express
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×2
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

MakeCode
Microsoft MakeCode

Story

Read more

Code

circuitplayground-Otto-DIY.uf2

Scratch
input.buttonA.onEvent(ButtonEvent.Click, function () {
    light.showAnimation(light.rainbowAnimation, 500)
    pins.A1.servoWrite(130)
    pins.A2.servoWrite(50)
    for (let i = 0; i < 8; i++) {
        pause(200)
        pins.A1.servoWrite(180)
        pause(100)
        pins.A2.servoWrite(0)
        pause(200)
        pins.A1.servoWrite(130)
        pause(100)
        pins.A2.servoWrite(50)
        pause(200)
    }
    pins.A1.servoWrite(130)
    pins.A2.servoWrite(50)
})
input.buttonB.onEvent(ButtonEvent.Click, function () {
    pins.A2.servoWrite(50)
    pins.A1.servoWrite(130)
    for (let i = 0; i < 8; i++) {
        pause(200)
        pins.A2.servoWrite(0)
        pause(200)
        pins.A1.servoWrite(180)
        pause(100)
        pins.A2.servoWrite(50)
        pause(200)
        pins.A1.servoWrite(130)
        pause(100)
    }
    pins.A1.servoWrite(130)
    pins.A2.servoWrite(50)
})
input.touchA3.onEvent(ButtonEvent.Click, function () {
    pins.A1.servoWrite(130)
    pins.A2.servoWrite(50)
    for (let i = 0; i < 4; i++) {
        pause(100)
        pins.A1.servoWrite(180)
        pause(100)
        pins.A1.servoWrite(130)
        pause(200)
    }
    for (let i = 0; i < 4; i++) {
        pause(100)
        pins.A2.servoWrite(80)
        pause(100)
        pins.A2.servoWrite(50)
        pause(200)
    }
})
input.onLoudSound(function () {
    if (input.soundLevel() >= 130) {
        for (let i = 0; i < 4; i++) {
            pins.A1.servoWrite(130)
            pins.A2.servoWrite(50)
            pause(300)
            pins.A1.servoWrite(180)
            pins.A2.servoWrite(0)
            pause(400)
        }
        pins.A1.servoWrite(130)
        pins.A2.servoWrite(50)
    }
})
pins.A1.servoWrite(130)
pins.A2.servoWrite(50)
forever(function () {
    light.showAnimation(light.rainbowAnimation, 2000)
    pause(2000)
    light.showAnimation(light.runningLightsAnimation, 500)
    pause(2500)
    light.showAnimation(light.colorWipeAnimation, 2000)
    pause(2500)
})

Credits

Smart Creativity

Smart Creativity

20 projects β€’ 10 followers
A creative student....πŸ§’πŸ§’πŸ§‘

Comments