edge lab LIVE! starts Tuesday in Munich. Grab a workshop seat and take home the board you build on. Code FRIEND-HACKSTER saves 20%. () Learn more!
Ty Adams
Published

Muh Strange controller

Controller for the Sega genesis made with mushrooms

BeginnerFull instructions provided213
Muh Strange controller

Things used in this project

Story

Read more

Schematics

code_bmEJC5FlrX.PNG

Code

Untitled file

JavaScript
input.onLoudSound(function () {
    keyboard.functionKey(KeyboardFunctionKey.Insert, KeyboardKeyEvent.Press)
})
input.touchA1.onEvent(ButtonEvent.Up, function () {
    keyboard.functionKey(KeyboardFunctionKey.RightArrow, KeyboardKeyEvent.Up)
})
input.onGesture(Gesture.Shake, function () {
	
})
input.touchA2.onEvent(ButtonEvent.Up, function () {
    keyboard.functionKey(KeyboardFunctionKey.LeftArrow, KeyboardKeyEvent.Up)
})
input.touchA3.onEvent(ButtonEvent.Up, function () {
    keyboard.key("z", KeyboardKeyEvent.Up)
})
input.touchA4.onEvent(ButtonEvent.Up, function () {
    keyboard.functionKey(KeyboardFunctionKey.UpArrow, KeyboardKeyEvent.Up)
})
input.touchA5.onEvent(ButtonEvent.Up, function () {
    keyboard.functionKey(KeyboardFunctionKey.DownArrow, KeyboardKeyEvent.Up)
})
input.touchA6.onEvent(ButtonEvent.Up, function () {
    keyboard.key("x", KeyboardKeyEvent.Up)
})
input.touchA7.onEvent(ButtonEvent.Up, function () {
    keyboard.functionKey(KeyboardFunctionKey.UpArrow, KeyboardKeyEvent.Up)
})
forever(function () {
    while (input.touchA1.isPressed()) {
        keyboard.functionKey(KeyboardFunctionKey.RightArrow, KeyboardKeyEvent.Down)
    }
    while (input.touchA2.isPressed()) {
        keyboard.functionKey(KeyboardFunctionKey.LeftArrow, KeyboardKeyEvent.Down)
    }
    while (input.touchA3.isPressed()) {
        keyboard.key("z", KeyboardKeyEvent.Down)
    }
    while (input.touchA4.isPressed()) {
        keyboard.functionKey(KeyboardFunctionKey.UpArrow, KeyboardKeyEvent.Down)
    }
    while (input.touchA5.isPressed()) {
        keyboard.functionKey(KeyboardFunctionKey.DownArrow, KeyboardKeyEvent.Down)
    }
    while (input.touchA6.isPressed()) {
        keyboard.key("x", KeyboardKeyEvent.Down)
    }
    while (input.touchA7.isPressed()) {
        keyboard.functionKey(KeyboardFunctionKey.UpArrow, KeyboardKeyEvent.Down)
    }
    while (input.touchA1.isPressed() && input.touchA6.isPressed()) {
        keyboard.functionKey(KeyboardFunctionKey.RightArrow, KeyboardKeyEvent.Down)
        keyboard.key("x", KeyboardKeyEvent.Down)
    }
    while (input.touchA2.isPressed() && input.touchA6.isPressed()) {
        keyboard.functionKey(KeyboardFunctionKey.LeftArrow, KeyboardKeyEvent.Down)
        keyboard.key("x", KeyboardKeyEvent.Down)
    }
})

Credits

Ty Adams
4 projects • 0 followers

Comments