hello sir,
Teensy is controller of my music sampler. Can i connect directly 3 legs rotary encoder to Pin 2, Pin 3 & GND..??? i want to use
rotery encoder (3 legs) instead of buttons conected to pin 2, pin 3.
i don't know, how to add rotery encoder in codes given below.
Code:
[code]
#include <Bounce.h>
Bounce pitchup = Bounce(0, 10);
Bounce pitchdown = Bounce(1, 10);
Bounce tempoup = Bounce(2, 10);
Bounce tempodown = Bounce(3, 10);
Bounce keytap = Bounce(4, 10);
Bounce leytap = Bounce(5, 10);
void setup() {
Mouse.screenSize(1366, 768); // configure screen size
pinMode(0, INPUT_PULLUP);
pinMode(1, INPUT_PULLUP);
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
}
void loop() {
pitchup.update();
pitchdown.update();
tempoup.update();
tempodown.update();
keytap.update();
leytap.update();
if (pitchup.fallingEdge()) {
Mouse.moveTo(357, 36); // point to pixel at (357, 36)
Mouse.set_buttons(1, 0, 0); // hold left button
Mouse.moveTo(357, 31);
Mouse.set_buttons(0, 0, 0); // hold left button
}
if (pitchdown.fallingEdge()) {
Mouse.moveTo(357, 36); // point to pixel at (357, 36)
Mouse.set_buttons(1, 0, 0); // hold left button
Mouse.moveTo(357, 41);
Mouse.set_buttons(0, 0, 0); // hold left button
}
if (tempoup.fallingEdge()) {
Mouse.moveTo(512, 54); // point to pixel at 512, 54
Mouse.scroll(+1); // turn scroll wheel upward 1 step
Mouse.moveTo(345, 94);
}
if (tempodown.fallingEdge()) {
Mouse.moveTo(512, 54); // point to pixel at 512, 54
Mouse.scroll(-1); // turn scroll wheel downward 1 step
Mouse.moveTo(345, 94);
}
if (keytap.fallingEdge()) {
Keyboard.set_key1(KEY_F6); // Press F6
Keyboard.send_now();
Keyboard.set_key1(0); //Release F6
Keyboard.send_now();
}
if (leytap.fallingEdge()) {
Keyboard.set_modifier(MODIFIERKEY_CTRL); //Press ctrl key
Keyboard.send_now();
Keyboard.set_key1(KEY_F5); //Press F5
Keyboard.send_now();
Keyboard.set_modifier(0); // Release ctrl key
Keyboard.set_key1(0); // Release F5
Keyboard.send_now();
}
}
please make changes in these code to add rotery encoder to pin 2, pin 3.
After complete my project(Diy Rhythm Sampler at home from your laptop to perfom live singing program without musicians),
My project is not personal, it is for you all of you.
I will full tutorial of this on this Forum. so please help me