solidsnake745 / MIDI_Device_Controller

An Arduino based library for controlling various devices via the MIDI interface
GNU General Public License v3.0
6 stars 0 forks source link

Add ability to invert outputs #48

Open solidsnake745 opened 3 months ago

solidsnake745 commented 3 months ago

While recently working/testing the shit register implementation, thought I'd pick up a relay board to test with. I've seen other people use these as percussion and wanted to use one also.

Picked up this relay board in particular: SunFounder 5V 8 Channel Relay Shield Module for Arduino

Later on read that the inputs are active low so they need to be set low/to ground to activate the associated relay.

Could be common that users need the ability to invert certain outputs to get the desired result. There should be a set of bitwise operations that can achieve this. Want to code it in a such a way that it's a setting you can set for each of the outputs in ByteNoteRegister. That way users can invert just the outputs they need and can be applied to any of the IO implementations.

solidsnake745 commented 3 months ago

This worked out well, but after using it, found that it would also be useful to be able to toggle the output rather than pulse. Pulsing the relay results in two clicks since it turns on and off. Ends up making the notes sound delayed or off.

In this case it would better to just change state so there is only one click per MIDI note action. Should be a pretty easy change to MIDI_Pulse_Controller. Figure it's a high level enough function that it belongs just there and can use existing IO_Device methods to complete. Don't think any additional or specific logic in IO_Device or it's implementations would be useful or more appropriate. Will open a separate issue to track.