control amplitude threshold via UI

This commit is contained in:
Lewis Moten
2024-05-01 22:10:38 -04:00
parent ad6e0d5197
commit d9be475a0f
2 changed files with 6 additions and 1 deletions

View File

@@ -10,6 +10,7 @@
<div class="panels"> <div class="panels">
<div> <div>
Bit Duration: <input id="bit-duration-text" type="number" min="0" max="1000" value="180">ms<br> Bit Duration: <input id="bit-duration-text" type="number" min="0" max="1000" value="180">ms<br>
Amplitude Threshold: <input id="amplitude-threshold-text" type="number" min="0" max="255" value="200"><br>
<input type="text" id="text-to-send"> <input type="text" id="text-to-send">
<button id="send-button">Send</button> <button id="send-button">Send</button>
<h2>Sent</h2> <h2>Sent</h2>

View File

@@ -38,7 +38,11 @@ function handleWindowLoad() {
FREQUENCY_DURATION = parseInt(event.target.value); FREQUENCY_DURATION = parseInt(event.target.value);
bitSampleCount = 0; bitSampleCount = 0;
samplesPerBit.length = 0; samplesPerBit.length = 0;
}) });
document.getElementById('amplitude-threshold-text').addEventListener('input', (event) => {
FREQUENCY_THRESHOLD = parseInt(event.target.value);
});
// wire up events // wire up events
sendButton.addEventListener('click', handleSendButtonClick); sendButton.addEventListener('click', handleSendButtonClick);