It started with simple camera slider project.I decided to add two buttons and three pot on my project.
That was easy and useful but I prefer less component, simple looking so I decided to control my unit with screen.
...and yyRobotics comes here! (That's my name 'Yılmaz Yurdakul').
Now, it is controlling 3 variable attached to analog outputs.
wiring is really simple. SDA, SCL, two pins for encoder, one pin for built in button...
void doEncoder() {
if (digitalRead(encoder0PinA) == HIGH) {
if (digitalRead(encoder0PinB) == LOW && encoder0Pos > 0) {
encoder0Pos = encoder0Pos - 1;
dir = 0;
}
else {
encoder0Pos = encoder0Pos + 1;
dir = 1;
}
}
else
{
if (digitalRead(encoder0PinB) == LOW ) {
encoder0Pos = encoder0Pos + 1;
dir = 1;
}
else {
if (encoder0Pos > 0) {
encoder0Pos = encoder0Pos - 1;
dir = 0;
}
}
}
This function controls turn count and menu controller transfers this count to variable. When user clicks the button, counter resets to 0. Also there is more simple and better way to control variables. You can use direction variable(dir).
if (menuCount == 1) {
if (dir ==1) {
valA++;
} else {
valA--;
}
}
____________________
After all, i decided to upgrade. I did so much improvisation because now i am working on midi controller project. I just completed controlling part. Here is the code. More stable, more effective.
I built new project. You can grab new menu codes from this project.
Comments