Go Down

Topic: coding pots (Read 393 times) previous topic - next topic

djbadja

any one care to help me code some pots for my midi controller
sketch is added
just need 4 pots added to my sketch they are on analog inputs 0, 1, 2 and 3
there aint much to do, but im stuck
any help would be sweet

PaulS

Arrays! Arrays! Arrays! Your code needs arrays.

What do you need these pots to do? How are they wired? What have you tried?

djbadja

these pots will be controlling effects parameters in ableton live, they are wired from 5v to ground and the signal pins goes to the analog inputs. what you mean by arrays? im a coding noob :)

PaulS

Quote
these pots will be controlling effects parameters in ableton live

No. What you mean is that you will use the value read from the pot to do something.

Reading the value from the pot is trivial:
Code: [Select]
int potVal = analogRead(potPin);

Using the value is up to you.

djbadja

yea sorry, so should this wee code you have shown be in my loop function?

retrolefty


yea sorry, so should this wee code you have shown be in my loop function?


That depends if your applications sketch needs to continously read the pots and update something or if your application only requires a one time only value from the pots. You as the programmer have the ultimate power on how and when and how often you use the values read from the pot. Of course with that power comes responsiblity on knowing what you wish to perform in your sketch application.

Lefty


Go Up