Smart Creativity
Published © CC BY

Touch responsive robot/circuitplayground /#smartcreativity

This robot responds when anyone touch it. Very cool..

BeginnerFull instructions provided1 hour245
Touch responsive robot/circuitplayground /#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

Software apps and online services

MakeCode
Microsoft MakeCode

Hand tools and fabrication machines

Multitool, Screwdriver
Multitool, Screwdriver

Story

Read more

Code

circuitplayground-touch-responsive.uf2

JavaScript
input.touchA7.onEvent(ButtonEvent.Down, function () {
    pins.A1.servoWrite(90)
    light.showRing(
    `pink black black black pink red red red red red`
    )
})
input.pinA4.onEvent(ButtonEvent.Down, function () {
    pins.A2.servoWrite(0)
    light.showRing(
    `yellow black black black yellow blue blue blue blue blue`
    )
})
input.touchA7.onEvent(ButtonEvent.Up, function () {
    pins.A1.servoWrite(30)
    light.showRing(
    `red black black black red pink pink pink pink pink`
    )
})
input.pinA4.onEvent(ButtonEvent.Up, function () {
    pins.A2.servoWrite(60)
    light.showRing(
    `blue black black black blue yellow yellow yellow yellow yellow`
    )
})
light.showAnimation(light.colorWipeAnimation, 2000)
pins.A2.servoWrite(0)
pins.A1.servoWrite(90)
forever(function () {
    light.setBrightness(15)
})

Credits

Smart Creativity

Smart Creativity

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

Comments