servo specific spin chirality
This commit is contained in:
parent
8624a0d139
commit
fa5243aa08
1 changed files with 6 additions and 5 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue