Reply to NEW to DJTT! need some help with coding

NEW to DJTT! need some help with coding
hello everyone,

so ive been playing around with the teensy ++ 2.0 and just need help with programming the potentiometers. im still trying to learn as much as possible about programming as ive never done anything like this before. ive already gone through most of the tutorials on PJRC as it does cover potentiometers but it doesnt say how to program it with MIDI. ive already had success with programing a few push buttons and using it with serato scratch live.

i have tried searching the community s and couldnt find the dirrect functions or code to use for potentiometers. ive also tried looking at Fuzzywobbles tutorial and code but i cant distinguish which code and function is for potentiometers

i will be using these potentiometers for doing various scrolling through serato scratch live

this is my circuit so far, i have the pots connected to PINS 38,39,40. i know that 10k ohm are recommended but i just had these in the garage and just wanted to do a quick test. if 100k is not compatible please let me know. please let me know if i have connected it incorrectly:



my code so far looks like this and would just like to add 3 Potentiometers to the code. it just has push buttons on PINS 0-5 (just taken directly from the USB example in teensyduino):

#include <Bounce.h>

const int channel = 1;

Bounce button0 = Bounce(0, 5);
Bounce button1 = Bounce(1, 5);
Bounce button2 = Bounce(2, 5);
Bounce button3 = Bounce(3, 5);
Bounce button4 = Bounce(4, 5);
Bounce button5 = Bounce(5, 5);

void setup() {

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() {

button0.update();
button1.update();
button2.update();
button3.update();
button4.update();
button5.update();

if (button0.fallingEdge()) {
usbMIDI.sendNoteOn(60, 99, channel);
}
if (button1.fallingEdge()) {
usbMIDI.sendNoteOn(61, 99, channel);
}
if (button2.fallingEdge()) {
usbMIDI.sendNoteOn(62, 99, channel);
}
if (button3.fallingEdge()) {
usbMIDI.sendNoteOn(63, 99, channel);
}
if (button4.fallingEdge()) {
usbMIDI.sendNoteOn(64, 99, channel);
}
if (button5.fallingEdge()) {
usbMIDI.sendNoteOn(65, 99, channel);
}

if (button0.risingEdge()) {
usbMIDI.sendNoteOff(60, 0, channel);
}
if (button1.risingEdge()) {
usbMIDI.sendNoteOff(61, 0, channel);
}
if (button2.risingEdge()) {
usbMIDI.sendNoteOff(62, 0, channel);
}
if (button3.risingEdge()) {
usbMIDI.sendNoteOff(63, 0, channel);
}
if (button4.risingEdge()) {
usbMIDI.sendNoteOff(64, 0, channel);
}
if (button5.risingEdge()) {
usbMIDI.sendNoteOff(65, 0, channel);
}

}

Any help would be greatly appreciated, or if this has already been covered please direct me to a thread or website

thanks all!
You need to login in order to write on our forum

<< Cancel

Copyright 2012-2023
DJRANKINGS.ORG n.g.o.
Chuo-ku, Osaka, Japan

Created by Ajaxel CMS

Terms & Privacy