Git Product home page Git Product logo

drcrecoverydata / 16bitshiftmatrixmidi Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 23 KB

To handle 16 bits, you would need 2 parallel-to-serial shift registers cascaded together. Each shift register provides 8 output bits, so by cascading two of them, you get a total of 16 output bits. This setup perfectly matches your requirement for a 4x4 button matrix, where you have 16 buttons.

C++ 100.00%

16bitshiftmatrixmidi's Introduction

MIDI Button Controller

This Arduino sketch allows you to create a MIDI button controller using shift registers. It reads the state of buttons connected to shift registers and sends MIDI notes accordingly.

Requirements

  • Arduino board compatible with MIDIUSB library
  • MIDI USB cable
  • Shift registers (e.g., 74HC595)
  • Momentary push buttons

Circuit Diagram

Circuit Diagram

Connecting a 4x4 Button Matrix to Two 74HC165 Shift Registers

Certainly! Here's how you can connect a 4x4 button matrix to two 74HC165 shift registers in a grid layout:

Button Matrix:

Button Connection
1 PI0 (Parallel Input 0) of first 74HC165
2 PI1 (Parallel Input 1) of first 74HC165
3 PI2 (Parallel Input 2) of first 74HC165
4 PI3 (Parallel Input 3) of first 74HC165
5 PI4 (Parallel Input 4) of first 74HC165
6 PI5 (Parallel Input 5) of first 74HC165
7 PI6 (Parallel Input 6) of first 74HC165
8 PI7 (Parallel Input 7) of first 74HC165
9 PI0 (Parallel Input 0) of second 74HC165
10 PI1 (Parallel Input 1) of second 74HC165
11 PI2 (Parallel Input 2) of second 74HC165
12 PI3 (Parallel Input 3) of second 74HC165
13 PI4 (Parallel Input 4) of second 74HC165
14 PI5 (Parallel Input 5) of second 74HC165
15 PI6 (Parallel Input 6) of second 74HC165
16 PI7 (Parallel Input 7) of second 74HC165

Shift Register Connections:

Pin Connection
Q7 Serial Data Input (DS) of second 74HC165
CLK Clock (CLK) of Arduino (or microcontroller)
ST_CP Latch (ST_CP) of Arduino (or microcontroller)
VCC +5V power supply
GND Ground

Button Matrix Layout

In a 4x4 button matrix layout, the buttons are typically numbered sequentially from left to right, top to bottom. Here's how the buttons would be numbered in a 4x4 grid:

16 15 14 13
12 11 10 9
8  7  6  5
4  3  2  1

Each number corresponds to a physical button in the matrix. For example, button 1 is the top-left button, button 2 is the button next to it to the right, and so on. This numbering scheme allows you to easily identify each button's position in the matrix.

Usage

  1. Connect your Arduino board to your computer via USB.
  2. Upload the sketch to your Arduino board.
  3. Connect the shift registers and buttons according to the circuit diagram.
  4. Use the buttons to trigger MIDI notes. Pressing a button sends a MIDI note-on message, and releasing it sends a MIDI note-off message.

How It Works

The sketch uses the MIDIUSB library to send MIDI messages via USB. It reads the state of buttons connected to shift registers by shifting in their states using the shiftIn function. When a button is pressed, it sends a MIDI note-on message, and when it's released, it sends a MIDI note-off message.

Credits

This sketch is adapted from Arduino MIDI Button Controller example provided by the MIDIUSB library.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.