Smart Creativity
Published Β© CC BY

Touch responsive robot/circuitplayground /#smartcreativity

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

BeginnerFull instructions provided1 hour258
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
25 projects β€’ 36 followers
A creative student....πŸ§’πŸ§’πŸ§‘
Contact

Comments

Please log in or sign up to comment.