# Add more inputs?

**URL:** <https://forum.makecode.com/t/add-more-inputs/3376>\
**Category:** Help\
**Created:** [September 7, 2020, 10:45am UTC](https://forum.makecode.com/t/add-more-inputs/3376 "2020-09-07T10:45:36Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Construc](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/construc/32/1533_2.png) [@Construc](https://forum.makecode.com/u/Construc)\
**Post date:** [September 7, 2020, 10:45am UTC](https://forum.makecode.com/t/add-more-inputs/3376/1 "2020-09-07T10:45:36Z")

</div>

hihi,  
im just exploring at the moment, looking at my options - i want to make a tiny little game, but the kind of game i want requires more inputs. i want to make a tiny twin-stick shooter.  
obviously it wont work if i wanted to share it with others, but thats doesnt bother me.  
is it at all possible to have more button inputs, or analog input?

---

<div class="post-metadata">

**Author:** ![LcAtonal](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/lcatonal/32/16800_2.png) [@LcAtonal](https://forum.makecode.com/u/LcAtonal)\
**Post date:** [September 7, 2020, 10:54am UTC](https://forum.makecode.com/t/add-more-inputs/3376/2 "2020-09-07T10:54:52Z")

</div>

You could use player 2 buttons but it only works for computers

---

<div class="post-metadata">

**Author:** ![LcAtonal](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/lcatonal/32/16800_2.png) [@LcAtonal](https://forum.makecode.com/u/LcAtonal)\
**Post date:** [September 7, 2020, 10:55am UTC](https://forum.makecode.com/t/add-more-inputs/3376/3 "2020-09-07T10:55:13Z")

</div>

There are combos too

---

<div class="post-metadata">

**Author:** ![Construc](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/construc/32/1533_2.png) [@Construc](https://forum.makecode.com/u/Construc)\
**Post date:** [September 7, 2020, 11:00am UTC](https://forum.makecode.com/t/add-more-inputs/3376/4 "2020-09-07T11:00:44Z")

</div>

so there’s no way to add more inputs, even through editing config or source files?

---

<div class="post-metadata">

**Author:** ![LcAtonal](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/lcatonal/32/16800_2.png) [@LcAtonal](https://forum.makecode.com/u/LcAtonal)\
**Post date:** [September 7, 2020, 1:44pm UTC](https://forum.makecode.com/t/add-more-inputs/3376/5 "2020-09-07T13:44:32Z")

</div>

I do not know anything about source file though

---

<div class="post-metadata">

**Author:** ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)\
**Post date:** [September 7, 2020, 1:52pm UTC](https://forum.makecode.com/t/add-more-inputs/3376/6 "2020-09-07T13:52:36Z")

</div>

On hardware, you can only use button combos if you don’t want to wire anything up. If you want to, you could wire some buttons up and connect them to the pins and read them in software.

If you are going to play using the computer only, you can use player 2’s controls. Press the keyboard button under the simulator while it’s running to see the keys requires to press.

---

<div class="post-metadata">

**Author:** ![Construc](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/construc/32/1533_2.png) [@Construc](https://forum.makecode.com/u/Construc)\
**Post date:** [September 8, 2020, 9:55am UTC](https://forum.makecode.com/t/add-more-inputs/3376/7 "2020-09-08T09:55:59Z")

</div>

oh!! so it _ **is** _ possible to add more buttons?  
ive been trying to read up on the documentation, but i cant find anything that explicitly states i can add more inputs, or how i would even access those inputs; [https://arcade.makecode.com/hardware/adding](https://arcade.makecode.com/hardware/adding)  
is it just a matter of defining more GPIO pins as buttons, and then calling those extra buttons in javascript?  
like this?

```auto
PIN_BTN_A = PIN_D6
PIN_BTN_B = PIN_D7
PIN_BTN_C = PIN_D8
PIN_BTN_D = PIN_D9
...
controller.A.onEvent();
controller.B.onEvent();
controller.C.onEvent();
controller.D.onEvent();
...

```

etc?

i also see `controller.dx`, is this for analog input? i can see there’s support for an accelerometer, does that mean MakeCode Arcade can do analog input?  
im a fairly technical person, but programming is not my strong suit, and neither is learning new things, so im just having a bit of trouble finding _where_ and _how_ to do the things i want to do 😅

---

<div class="post-metadata">

**Author:** ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)\
**Post date:** [September 8, 2020, 11:47am UTC](https://forum.makecode.com/t/add-more-inputs/3376/8 "2020-09-08T11:47:05Z")

</div>

`controller.dx` and `controllee.dy` should be analog.

For the hardware buttons, you would just define the inputs, and read them in a loop. I don’t really use them that much, but o think there should be events for it. Look in [maker.makecode.com](http://maker.makecode.com) for examples.

And yes, on some hardware, there is support for the accelerometer.

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [September 14, 2020, 4:07pm UTC](https://forum.makecode.com/t/add-more-inputs/3376/9 "2020-09-14T16:07:04Z")

</div>

If you add the controller extension to your project, you should get some accelerometer blocks as well as some other random sensors.

---

<div class="post-metadata">

**Author:** ![jackal](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/jackal/32/19506_2.png) [@jackal](https://forum.makecode.com/u/jackal)\
**Post date:** [August 31, 2021, 2:49am UTC](https://forum.makecode.com/t/add-more-inputs/3376/10 "2021-08-31T02:49:14Z")

</div>

Or you can use the keyboard extension and use it with your hardware device.

---

<div class="post-metadata">

**Author:** ![Primal\_Nexus](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/primal_nexus/32/3540_2.png) [@Primal\_Nexus](https://forum.makecode.com/u/Primal_Nexus)\
**Post date:** [September 1, 2021, 4:16pm UTC](https://forum.makecode.com/t/add-more-inputs/3376/11 "2021-09-01T16:16:28Z")

</div>

Yep @jackal, that’s three main choices, 2P controls (PC only, no hardware), Manually wiring new numbers (hardware only) or using the keyboard extension (PC and hardware). I think I know which option is the best, but that’s a choice for you.

---

<div class="post-metadata">

**Author:** ![kwx](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/kwx/32/1545_2.png) [@kwx](https://forum.makecode.com/u/kwx)\
**Post date:** [September 1, 2021, 10:23pm UTC](https://forum.makecode.com/t/add-more-inputs/3376/12 "2021-09-01T22:23:03Z")

</div>

If you need four control axes, I think using 2P controls on PC emulator and stick+accelerometer on hardware is worth exploring. It may not be a good fit for a twin-stick shooter though.

One warning - last I checked, reading accelerometer inputs activates an emulated mode that makes other inputs on the Android emulator difficult to use, so you may want to make that a configurable option.

Is there a supported way to feature detect an actual accelerometer to distinguish it from emulation? Based on [How can I access the name of my program? - #8 by mmoskal](https://forum.makecode.com/t/how-can-i-access-the-name-of-my-program/764/8), maybe along the lines of `control.getConfigValue(DAL.CFG_ACCELEROMETER_TYPE, 0)` ?
