Giter VIP home page Giter VIP logo

Comments (7)

tttapa avatar tttapa commented on May 25, 2024 2

You can't use multiplexers for LEDs. (You would have to scan through all LEDs really quickly to create a POV, which uses a lot of resources.)
You can, however, use shift registers, which are much more suited for driving LEDs. You only need three digital outputs to drive many LEDs.

For example:

/*
This is an example of the "ShiftRegisterOut" class of the Control_Surface library.
Connect three daisy-chained shift registers to pins 11 (ST_CP), 12 (DS) and 10 (SH_CP).
Connect 8 RGB LEDs (+ current limiting resistors) to the outputs of the shift registers
(R-G-B-R-G-B-...).
If blue LEDs light up when red ones should, either flip all the LEDs, or change the
bit order in the ShiftRegisterOut constructor to 'MSBFIRST' instead fo 'LSBFIRST'.
10 >──────────────┬─────────────────────────────┬─────────────────────────────┐
┎━━━━━━━━━━┷━━━━━━━━━━━┓ ┎━━━━━━━━━━┷━━━━━━━━━━━┓ ┎━━━━━━━━━━┷━━━━━━━━━━━┓
┃ SH_CP ┃ ┃ SH_CP ┃ ┃ SH_CP ┃
12 >───┨ Data in Data out ┠──────┨ Data in Data out ┠──────┨ Data in Data out ┃
┃ ST_CP ┃ ┃ ST_CP ┃ ┃ ST_CP ┃
┗━━━━━━━━━━┯━━━━━━━━━━━┛ ┗━━━━━━━━━━┯━━━━━━━━━━━┛ ┗━━━━━━━━━━┯━━━━━━━━━━━┛
11 >──────────────┴─────────────────────────────┴─────────────────────────────┘
The 8 LEDs represent 8 channels. A red LED indicates that the channel is muted,
a green LED indicates that solo is enabled, and a blue LED indicates that the
channel is armed for recording.
Map the Arduino as a Mackie Control Universal in your DAW or DJ software.
Written by Pieter P, 22-03-2018
https://github.com/tttapa/Control_Surface
*/
#include <Control_Surface.h> // Include the library
const pin_t dataPin = 12; //Pin connected to DS of 74HC595
const pin_t clockPin = 10; //Pin connected to SH_CP of 74HC595
const pin_t latchPin = 11; //Pin connected to ST_CP of 74HC595
// Create a new shift register output connected to pins 11, 13 and 10, shift the data out with the least significant bit first,
// There are 24 (= 3·8) outputs in total.
ShiftRegisterOut ShiftReg(dataPin, clockPin, latchPin, LSBFIRST, 24);
const uint8_t channel = 1;
MIDI_LED leds[] = {
{ShiftReg.red(0), MCU::MUTE_1, channel},
{ShiftReg.red(1), MCU::MUTE_2, channel},
{ShiftReg.red(2), MCU::MUTE_3, channel},
{ShiftReg.red(3), MCU::MUTE_4, channel},
{ShiftReg.red(4), MCU::MUTE_5, channel},
{ShiftReg.red(5), MCU::MUTE_6, channel},
{ShiftReg.red(6), MCU::MUTE_7, channel},
{ShiftReg.red(7), MCU::MUTE_8, channel},
{ShiftReg.green(0), MCU::SOLO_1, channel},
{ShiftReg.green(1), MCU::SOLO_2, channel},
{ShiftReg.green(2), MCU::SOLO_3, channel},
{ShiftReg.green(3), MCU::SOLO_4, channel},
{ShiftReg.green(4), MCU::SOLO_5, channel},
{ShiftReg.green(5), MCU::SOLO_6, channel},
{ShiftReg.green(6), MCU::SOLO_7, channel},
{ShiftReg.green(7), MCU::SOLO_8, channel},
{ShiftReg.blue(0), MCU::REC_RDY_1, channel},
{ShiftReg.blue(1), MCU::REC_RDY_2, channel},
{ShiftReg.blue(2), MCU::REC_RDY_3, channel},
{ShiftReg.blue(3), MCU::REC_RDY_4, channel},
{ShiftReg.blue(4), MCU::REC_RDY_5, channel},
{ShiftReg.blue(5), MCU::REC_RDY_6, channel},
{ShiftReg.blue(6), MCU::REC_RDY_7, channel},
{ShiftReg.blue(7), MCU::REC_RDY_8, channel},
};
void setup() {} // Nothing to set up
void loop() {
// Refresh the Control Surface (read MIDI input and update LEDs).
Control_Surface.refresh();
}

from control-surface.

tttapa avatar tttapa commented on May 25, 2024 2

Note that you don't have to use RGB LEDs, you can use ordinary LEDs as well, and you can use any number of shift registers.

For example, if you want a single shift register with 8 normal LEDs:

 ShiftRegisterOut ShiftReg(dataPin, clockPin, latchPin, LSBFIRST, 8); 
  
 MIDI_LED leds[] = { 
   {ShiftReg.pin(0), MCU::MUTE_1, channel}, 
   {ShiftReg.pin(1), MCU::MUTE_2, channel}, 
   {ShiftReg.pin(2), MCU::MUTE_3, channel}, 
   {ShiftReg.pin(3), MCU::MUTE_4, channel}, 
   {ShiftReg.pin(4), MCU::MUTE_5, channel}, 
   {ShiftReg.pin(5), MCU::MUTE_6, channel}, 
   {ShiftReg.pin(6), MCU::MUTE_7, channel}, 
   {ShiftReg.pin(7), MCU::MUTE_8, channel},  
 }; 

from control-surface.

tttapa avatar tttapa commented on May 25, 2024 1

You can use AnalogMultiplex for buttons as well.
Or you can use a button matrix.

from control-surface.

brian12112 avatar brian12112 commented on May 25, 2024

Wow, Its a great news. I waiting for this. Thank you tttapa.

from control-surface.

brian12112 avatar brian12112 commented on May 25, 2024

Wow, I am consider to using it with Standalone LEDs. Thank You again tttapa. It helps me a lot!

from control-surface.

brian12112 avatar brian12112 commented on May 25, 2024

Just one last questions. There is a solution to using multiplexer or shift register for the buttons? Thanks B4!

from control-surface.

brian12112 avatar brian12112 commented on May 25, 2024

Thanks. I'll give it a try.

from control-surface.

Related Issues (20)

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.