diff --git a/firmware/braille_xr/braille_xr.ino b/firmware/braille_xr/braille_xr.ino index 14bf365..5e7cdd6 100644 --- a/firmware/braille_xr/braille_xr.ino +++ b/firmware/braille_xr/braille_xr.ino @@ -12,12 +12,13 @@ char in_char = ' '; struct ServoPin { Servo servo; int pin; + int spin; // -1 left, +1 right }; ServoPin servos[6] = { - {Servo(), 14}, {Servo(), 5}, - {Servo(), 12}, {Servo(), 4}, - {Servo(), 13}, {Servo(), 2} // 19 and 21 are untested + {Servo(), 14, +1}, {Servo(), 5, -1}, + {Servo(), 12, -1}, {Servo(), 4, +1}, + {Servo(), 13, +1}, {Servo(), 2, -1} // 19 and 21 are untested }; // braille alphabet @@ -248,8 +249,8 @@ void loop() { BrailleChar bc = braille_map[in_char]; for (int i = 0; i < 6; i++) { int state = bc.servo_states[i]; - int s = i % 2 == 0 ? state : (1 - state); - servos[i].servo.write(s * 180); + int spin = servos[i].spin < 0 ? (1 - state) : state; + servos[i].servo.write(spin * 90); } old_char = in_char;