From cda3d1210d876ceb82d4e792e07cc4d6a0ba9559 Mon Sep 17 00:00:00 2001 From: giulio93 Date: Thu, 27 Jun 2024 11:48:32 +0200 Subject: [PATCH 1/2] Encoder and distance as theremin --- .../Modulino_Theremin/Modulino_Theremin.ino | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 examples/Modulino_Theremin/Modulino_Theremin.ino diff --git a/examples/Modulino_Theremin/Modulino_Theremin.ino b/examples/Modulino_Theremin/Modulino_Theremin.ino new file mode 100644 index 0000000..fd79184 --- /dev/null +++ b/examples/Modulino_Theremin/Modulino_Theremin.ino @@ -0,0 +1,32 @@ +#include "Modulino.h" + +ModulinoBuzzer buzzer; +ModulinoDistance distance; +ModulinoKnob encoder; + + +void setup() { + + Modulino.begin(); + encoder.begin(); + distance.begin(); + buzzer.begin(); +} + +int pitch = 0; +int noteIndex = 0; + +//Notes from C to B with # +int note[] = {262, 277, 294, 311, 330, 349, 370, 392, 415, 440, 466, 494}; + +void loop() { + pitch = distance.get(); + noteIndex = encoder.get(); + + noteIndex = noteIndex % 11; + if (noteIndex < 0){ + noteIndex = 0; + } + + buzzer.tone(note[noteIndex] + pitch, 1000); +} \ No newline at end of file From a15c4169a7d41e32ecf7c69bd6bba294982e8762 Mon Sep 17 00:00:00 2001 From: giulio93 Date: Wed, 16 Apr 2025 11:27:31 +0200 Subject: [PATCH 2/2] move it under Buzzer exaple --- .../Theremin/Theremin.ino} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename examples/{Modulino_Theremin/Modulino_Theremin.ino => Modulino_Buzzer/Theremin/Theremin.ino} (100%) diff --git a/examples/Modulino_Theremin/Modulino_Theremin.ino b/examples/Modulino_Buzzer/Theremin/Theremin.ino similarity index 100% rename from examples/Modulino_Theremin/Modulino_Theremin.ino rename to examples/Modulino_Buzzer/Theremin/Theremin.ino