![]() ![]() 100 BAT54W-HG3 Schottky diodes in SOD123 package (first one that popped up in a Mouser search so definitely just an example) should cost less than $10 USD. The diode allows you to detect each button/key separately. If you use a Schottky diode (for the low voltage drop) per button (or a diode pair per button pair), you need R digital outputs and C digital inputs for R× C buttons. I had a rotary switch to select between preprogrammed sets.) (I think the first microcontroller project I ever did was this arcade joystick with a couple of buttons with a Teensy 2.0++, that I used to produce configurable keyboard key codes so I could play SuperTux and online Flash games with it. This thread has a custom Joystick that can support up to 128 buttons, but a lot of OSes and programs have issues with joysticks having that many buttons. If you are referring to the 32-button limit per USB Joystick, I recommend making your Teensy an USB Keyboard + Joystick pair, with the extra buttons producing standard keypresses. If you want to run LEDs, you can do both input and output on three lines, and chain as many devices as you want. I think you'll find the code to scan a matrix is no less complex than the code to pull stuff out of a shift register. Shift registers cost more than diodes, and you have to decide what the trade-off is. Once you get it working, you will see that it's incredibly easy. (Or you can pack the data into binary form, where 1 byte tells you the state of 8 buttons, but this MCU has so much memory that I wouldn't bother.) You can write the data pin's state to a char array long enough to hold the output of all the shift registers. done eight times, because there are eight pins. To make it easier to understand, imagine you have just 8 buttons, and they're wired to a shift register. No additional chips go between the registers and the MCU it looks like this: MCU -> shift register 0 -> shift register 1 -> shift register 2 -> (etc.) If you use 8-line shift registers, each row (or column, whatever's easier) gets one register or if you get 16-line registers, each can handle two rows or two columns. In this way, there is no external chip, but you gotta route a LOT of lines to the MCU. If your matrix is 7x7, you need ground + 14 lines. I haven't done that before, but I think you also need some diodes in there somewhere. That could work, if the buttons are in a matrix. This way, you might get away with a two-layer board. Imagine the alternative: gnarly fan-out, possibly crazy vias or even jumpers. The registers can be placed good and close to the buttons, and then you only have to figure out two traces to the Teensy. You can also see how much easier this is going to make your PCB routing. On the other hand, if you want to drive LEDs, bi-directional knocks out two problems at once. If you are only reading, you only need two lines. I think it's bi-directional, and there has to be a third "latch" line so all the registers activate their transistors at the same instant. Four 16-line registers will more than take care of your project, and all you need is two pins on the MCU! The example uses three lines, but only because of the specifics of the register ICs used. you want more lines, all you have to do is chain in more shift registers. ![]() That project drives output, you want input, but other than that it's the same idea. I have to say that the background music is very pleasing to ear.Teensy supports eleventy hundred trillion buttons if you use shift registers. I have configured the game to use WASD for up, left, down, right respectively and J for Jump. Now you can configure the keys for up, down, left, right, jump etc. I found the default key-action mapping is difficult to use. Sudo apt-get install supertux Adjust Key-Action Mappings Then update local package index and install SuperTux 0.4. sudo nano /etc/apt/sources.listĪppend the following two lines at the end. sudo apt-key adv -keyserver -recv-keys 852541CB Sudo apt-get install supertux supertux-data Install SuperTux 0.4 on Debian 8 sudo add-apt-repository ppa:ubuntuhandbook1/apps You can also start it by typing the below command in the terminal window: supertux2 Install SuperTux 0.4 on Ubuntu 14.04/Linux Mint/Elementary OS SuperTux 0.4 is available on Ubuntu 16.04 from repository, so run the following command to install this game on Ubuntu 16.04. This tutorial shows how to install SuperTux 0.4 on Ubuntu 16.04/14.04, Linux Mint/Elementary OS and Debian 8. SuperTux 0.4 is released on December 2015. SuperTux is a 2D sidescroller game similar to the original Super Mario game.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |