NEW to DJTT! need some help with coding

Home :: Reviews of DJ equipment :: NEW to DJTT! need some help with codingReply
NEW to DJTT! need some help with coding
Posted on: 14.12.2012 by Stella Mcgarr
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!
Jaquelyn Brenny
27.12.2012
Originally Posted by Scornil01
So im trying to program the pot to continue to scroll when it is fully cranked and stationary. Any help with the code? Or is it a specific type or potentiometer needed to do this action?
you cannot do this with a pot, you need a rotary encoder. It allows endless turn in either direction
http://en.wikipedia.org/wiki/Rotary_...rotary_encoder
http://playground.arduino.cc/Main/RotaryEncoders

Or you can try the following: when pot is turned all the way left or right (analogRead should return 0 or 255 in this case), continue sending midi command to scroll up/down until the value changes. But I believe that encoder would give a more convenient way for controlling library scroll
Stella Mcgarr
14.12.2012
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!
Jaquelyn Brenny
27.12.2012
Originally Posted by Scornil01
So im trying to program the pot to continue to scroll when it is fully cranked and stationary. Any help with the code? Or is it a specific type or potentiometer needed to do this action?
you cannot do this with a pot, you need a rotary encoder. It allows endless turn in either direction
http://en.wikipedia.org/wiki/Rotary_...rotary_encoder
http://playground.arduino.cc/Main/RotaryEncoders

Or you can try the following: when pot is turned all the way left or right (analogRead should return 0 or 255 in this case), continue sending midi command to scroll up/down until the value changes. But I believe that encoder would give a more convenient way for controlling library scroll
Kellie Myrum
26.12.2012
You need endless rotary encoder in relative mode.
Stella Mcgarr
26.12.2012
Hey guys. So I had success in programming the potentiometer to work with Serato. I am using this particular pot to scroll through the library. The problem I'm having now is that SSL is reading the potentiometer but when the potentiometer is turned all the way up the scrolling stops. So even though there are plenty more songs I can scroll through the knob cannot reach it because it doesnt continue to scroll. I am really aiming for the pot to work like this (@6:11)



So im trying to program the pot to continue to scroll when it is fully cranked and stationary. Any help with the code? Or is it a specific type or potentiometer needed to do this action?
Janyce Henningson
23.12.2012
No probs, I started from this:
https://github.com/ghztomash/MIDI-Ro...coder_MIDI.ino
Stella Mcgarr
22.12.2012
Thank you very much Nicky H. That is exactly what I needed! Just gotta add it to my above code to go with my push buttons.

Do you happen to have any reference for programming encoders also?
Janyce Henningson
21.12.2012
The code above is for buttons not pots mate.

There's a nice midi tutorial here for a single pot - I used it originally and went from there:

http://little-scale.blogspot.co.uk/2...ontroller.html

Try getting 1 working as a USB midi device then you can add more when it's good.
Stella Mcgarr
21.12.2012
any help guys? Still can't figure out how these pots are programmed.

<< Back to Reviews of DJ equipment Reply

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

Created by Ajaxel CMS

Terms & Privacy