Add command to enable/disable key output. (#29)

This function is needed for preventing the device from submitting serial
commands by itself during calibration.
This commit is contained in:
Tatsuhisa Yamaguchi
2024-10-03 19:09:09 +09:00
committed by Takashi Toyoshima
parent 3561e299ce
commit 6f8ee87e94
2 changed files with 8 additions and 10 deletions

View File

@@ -54,13 +54,15 @@ We have tried it with PLA, but it will probably work with ABS as well.
## Sensor calibration
1. Open Serial Monitor.
2. (the home position, which decides when to commit a character)
2. Send '!' once to disable key output.
3. (the home position, which decides when to commit a character)
Bend the sensor slightly and send '0'. Make sure the LED turns off when the spoon is not bent by external force.
3. (the position for the first letter)
4. (the position for the first letter)
Bend the sensor slightly a bit more and send '1'.
4. (the position for the last letter)
5. (the position for the last letter)
Bend the sensor to the end and send '2'.
5. Send 'w' to save the configuration to EEPROM.
6. Send 'w' to save the configuration to EEPROM.
7. Send '!' again to enable key output, or reset the device.
# Wireless Version

View File

@@ -77,16 +77,12 @@ void LoadDefaultConfig() {
void setup() {
Serial.begin(115200);
Keyboard.begin();
LoadConfig();
pinMode(kLedPin, OUTPUT);
digitalWrite(kLedPin, LOW);
}
void SetupKeyboard() {
enable_key_output = true;
Keyboard.begin();
}
void OutputKey(const char* str) {
if (!enable_key_output) {
Serial.print(str);
@@ -152,7 +148,7 @@ void loop() {
// Other debug commands.
case '!':
SetupKeyboard();
enable_key_output = !enable_key_output;
break;
case ' ':
// Show sensor status for debugging.