chiral
This commit is contained in:
parent
0860b568af
commit
33cfcd5c91
1 changed files with 9 additions and 2 deletions
|
@ -29,9 +29,9 @@ ServoPin servos[6] = {
|
||||||
// 00
|
// 00
|
||||||
// braille alphabet array
|
// braille alphabet array
|
||||||
struct BrailleChar {
|
struct BrailleChar {
|
||||||
int servoStates[6];
|
int servo_states[6];
|
||||||
};
|
};
|
||||||
std::unordered_map<char, BrailleChar> brailleMap = {
|
std::unordered_map<char, BrailleChar> braille_map = {
|
||||||
{' ', {{
|
{' ', {{
|
||||||
0, 0,
|
0, 0,
|
||||||
0, 0,
|
0, 0,
|
||||||
|
@ -240,6 +240,13 @@ void loop() {
|
||||||
// udp.broadcast("Anyone here?");
|
// udp.broadcast("Anyone here?");
|
||||||
|
|
||||||
if (in_char != old_char) {
|
if (in_char != old_char) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
old_char = in_char;
|
old_char = in_char;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue