Hackster is hosting Hackster Holidays, Ep. 5: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 5 on Friday!
Smart Creativity
Published © CC BY

How to make a dancing robot without Arduino/#smartcreativity

This robot is able to dance, auto balancing, music producing and walking.

BeginnerFull instructions provided2 hours681
How to make a dancing robot without Arduino/#smartcreativity

Things used in this project

Hardware components

Circuit Playground Express
Adafruit Circuit Playground Express
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Battery Holder, 3 x AAA
Battery Holder, 3 x AAA
×1
AA Batteries
AA Batteries
×1

Software apps and online services

MakeCode
Microsoft MakeCode

Story

Read more

Custom parts and enclosures

BODY

Body

Required material

Code

Robot code

Java
upload it
input.onLoudSound(function () {
    for (let i = 0; i < 4; i++) {
        if (input.soundLevel() >= 130) {
            for (let i = 0; i < 4; i++) {
                pins.A1.servoWrite(155)
                pins.A2.servoWrite(25)
                pause(500)
                pins.A1.servoWrite(130)
                pins.A2.servoWrite(50)
                pause(500)
            }
            pins.A1.servoWrite(130)
            pins.A2.servoWrite(50)
        }
        light.showAnimation(light.rainbowAnimation, 500)
        pins.A1.servoWrite(130)
        pins.A2.servoWrite(50)
        for (let i = 0; i < 6; i++) {
            pause(200)
            pins.A1.servoWrite(170)
            pause(100)
            pins.A2.servoWrite(10)
            pause(200)
            pins.A1.servoWrite(130)
            pause(100)
            pins.A2.servoWrite(50)
            pause(200)
        }
        pins.A1.servoWrite(130)
        pins.A2.servoWrite(50)
        for (let i = 0; i < 6; i++) {
            pause(200)
            pins.A2.servoWrite(10)
            pause(200)
            pins.A1.servoWrite(170)
            pause(100)
            pins.A2.servoWrite(50)
            pause(200)
            pins.A1.servoWrite(130)
            pause(100)
        }
        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)
        }
        pins.A1.servoWrite(130)
        pins.A2.servoWrite(50)
    }
})
pins.A1.servoWrite(130)
pins.A2.servoWrite(50)
forever(function () {
    light.setBrightness(255)
    light.showAnimation(light.rainbowAnimation, 2000)
    pause(2000)
    light.showAnimation(light.runningLightsAnimation, 500)
    pause(2500)
    light.showAnimation(light.colorWipeAnimation, 2000)
    pause(2500)
})
forever(function () {
    music.playMelody("C5 B A G F E D C ", 120)
    music.playMelody("C D E F G A B C5 ", 120)
    music.playMelody("E B C5 A B G A F ", 120)
    music.playMelody("C5 A B G A F G E ", 120)
})

Credits

Smart Creativity

Smart Creativity

25 projects β€’ 36 followers
A creative student....πŸ§’πŸ§’πŸ§‘

Comments