tttapa / Control-Surface

Arduino library for creating MIDI controllers and other MIDI devices.
GNU General Public License v3.0
1.25k stars 139 forks source link

Can I connect a HC-SR04 module instead of a potentiometer? #590

Open e36910 opened 3 years ago

e36910 commented 3 years ago

I would like to try to make a sensor expression pedal from this module Скриншот 20-10-2021 214420

tttapa commented 3 years ago

You cannot use it as a potentiometer, because you have to drive it differently, it doesn't output an analog signal.
However, there are plenty of tutorials on the internet on how to measure the distance, and once you have that, you can map it to a range from 0 to 127 (or 0 to 16383 for a 14-bit control) and send it over MIDI as explained in https://tttapa.github.io/Control-Surface-doc/Doxygen/d3/df7/midi-tutorial.html#midi_md-sending.

e36910 commented 3 years ago

I found a library for this device - https://bitbucket.org/teckel12/arduino-new-ping/downloads/ Is it possible to link this library with Control Surface?

tttapa commented 3 years ago

Is it possible to link this library with Control Surface?

You don't have to link the libraries.
The ping library gives you a value, and then you send that value over MIDI using Control Surface.

Wallirec commented 2 years ago

There is a link to the files https://www.youtube.com/watch?v=mWa1He9FP5U

CriusDigitalStudio commented 2 years ago

I have already made this but I was using an Arduino Nano and Midi.h library. You can find everything about that at my website https://www.criusdigitalstudio.com/projects-english/crius-force-control-sonar-midi-controller . You can easily use it with the Control Surface library with small changes in the code.