I made some progress. I have my rotary encoder now outputting the right arrow key press when turned to the right and left arrow key press when turned to the left.
int val;
int encoder0PinA = 3;
int encoder0PinB = 4;
int encoder0Pos = 0;
int encoder0PinALast = LOW;
int n = LOW;
void setup() {
pinMode (encoder0PinA,INPUT);
pinMode (encoder0PinB,INPUT);
pinMode (10, INPUT); //X Axis//
pinMode (11, INPUT); //Y Axis//
pinMode (12, INPUT); //Z Axis//
pinMode (13, INPUT); //A Axis//
Serial.begin (115200);
}
void loop() {
n = digitalRead(encoder0PinA);
if ((encoder0PinALast == LOW) && (n == HIGH)) {
if (digitalRead(encoder0PinB) == LOW) {
encoder0Pos--;
//if (digitalRead(10, HIGH));
Keyboard.write(215);
} else {
encoder0Pos++;
Keyboard.write(216);
}
/** Serial.print (encoder0Pos);
** Serial.print ("/");
*/
}
encoder0PinALast = n;
}
I added the 4 inputs to monitor at the top, 10, 11, 12 & 13
So depending one which is grounded, I need to change the keyboard press output. Can someone suggest how to do this?
I thought IF digitalWrite (10,HIGH) then Keyboard.write(215);
Would work but it doesn't I figured I would need 4 "statements" and depending on which input was low, then it would Keyboard.write(XXX)
Thanks again in advance
Marty