Kevin Horan
Published

Assignment 4: Strange Controller

Control the video game Vampire Survivors using only potatoes!

BeginnerFull instructions provided25
Assignment 4: Strange Controller

Things used in this project

Hardware components

Alligator Clips
Alligator Clips
×1
Circuit Playground Express
Adafruit Circuit Playground Express
×1
Potato
×4
Carboard Box
×1

Software apps and online services

MakeCode
Microsoft MakeCode

Hand tools and fabrication machines

Scissors

Story

Read more

Schematics

screenshot-makecode_adafruit_com-2022_12_06-17_41_07_mweQJnacY5.png

Code

PotatoController

JavaScript
// DOWN - Yellow WIRE
input.touchA7.onEvent(ButtonEvent.Down, function () {
    light.showRing(
        `black black black black green green black black black black`
    )
    keyboard.functionKey(KeyboardFunctionKey.DownArrow, KeyboardKeyEvent.Down)
})
// LEFT - BLUE WIRE
input.touchA3.onEvent(ButtonEvent.Down, function () {
    light.showRing(
        `black black green black black black black black black black`
    )
    keyboard.functionKey(KeyboardFunctionKey.LeftArrow, KeyboardKeyEvent.Down)
})
input.onLoudSound(function () {
    light.showAnimation(light.rainbowAnimation, 200)
    keyboard.type(" ")
})
// DOWN - Yellow WIRE
input.touchA7.onEvent(ButtonEvent.Up, function () {
    keyboard.functionKey(KeyboardFunctionKey.DownArrow, KeyboardKeyEvent.Up)
    light.setAll(0x000000)
})
input.touchA3.onEvent(ButtonEvent.Up, function () {
    keyboard.functionKey(KeyboardFunctionKey.LeftArrow, KeyboardKeyEvent.Up)
    light.setAll(0x000000)
})
// RIGHT - BLACK WIRE
input.touchA2.onEvent(ButtonEvent.Down, function () {
    light.showRing(
        `black black black black black black black green black black`
    )
    keyboard.functionKey(KeyboardFunctionKey.RightArrow, KeyboardKeyEvent.Down)
})
// UP - RED WIRE
input.touchA6.onEvent(ButtonEvent.Down, function () {
    light.showRing(
        `green black black black black black black black black green`
    )
    keyboard.functionKey(KeyboardFunctionKey.UpArrow, KeyboardKeyEvent.Down)
})
input.touchA2.onEvent(ButtonEvent.Up, function () {
    keyboard.functionKey(KeyboardFunctionKey.RightArrow, KeyboardKeyEvent.Up)
    light.setAll(0x000000)
})
input.touchA6.onEvent(ButtonEvent.Up, function () {
    keyboard.functionKey(KeyboardFunctionKey.UpArrow, KeyboardKeyEvent.Up)
    light.setAll(0x000000)
})

Credits

Kevin Horan

Kevin Horan

4 projects • 1 follower

Comments