/********* Pleasedontcode.com **********
Pleasedontcode thanks you for automatic code generation! Enjoy your code!
- Terms and Conditions:
You have a non-exclusive, revocable, worldwide, royalty-free license
for personal and commercial use. Attribution is optional; modifications
are allowed, but you're responsible for code maintenance. We're not
liable for any loss or damage. For full terms,
please visit pleasedontcode.com/termsandconditions.
- Project: **Input Monitor**
- Source Code NOT compiled for: Arduino Uno
- Source Code created on: 2025-02-15 20:53:00
********* Pleasedontcode.com **********/
/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
/* The system shall initialize connected components */
/* and execute a loop that monitors input signals, */
/* triggering specific actions based on user */
/* interactions with the hardware. */
/****** END SYSTEM REQUIREMENTS *****/
/* START CODE */
/****** DEFINITION OF LIBRARIES *****/
#include // Added to support Keyboard functionality
/****** FUNCTION PROTOTYPES *****/
void setup(void);
void loop(void);
void updateOutputs(void); // Function prototype for updating outputs
/***** DEFINITION OF DIGITAL OUTPUT PINS *****/
const uint8_t myLED_LED_PIN_D2 = 2; // LED pin
const int dah = 3; // Declaring paddle input pin for dah
const int dit = 4; // Declaring paddle input pin for dit (Updated to avoid conflict)
/***** DEFINITION OF OUTPUT RAW VARIABLES *****/
/***** used to store raw data *****/
bool myLED_LED_PIN_D2_rawData = 0;
/***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/
/***** used to store data after characteristic curve transformation *****/
float myLED_LED_PIN_D2_phyData = 0.0;
int previousdahState = HIGH;
int previousditState = HIGH;
void setup(void)
{
// Initialize connected components
pinMode(myLED_LED_PIN_D2, OUTPUT);
// Declare the inputs as input_pullup
pinMode(dah, INPUT_PULLUP);
pinMode(dit, INPUT_PULLUP);
Keyboard.begin(); // Initialize Keyboard library
}
void loop(void)
{
// Execute a loop that monitors input signals
updateOutputs(); // Refresh output data
// Checking the state of the inputs
int dahState = digitalRead(dah);
int ditState = digitalRead(dit);
// Trigger specific actions based on user interactions
// Replaces left paddle input with dit using "[" as defined by VBand website
if (dahState == LOW && previousdahState == HIGH) {
// and it's currently pressed:
Keyboard.press(93);
delay(50);
}
if (dahState == HIGH && previousdahState == LOW) {
// and it's currently released:
Keyboard.release(93);
delay(50);
}
// Replaces right paddle input with dah using "]" as defined by VBand website
if (ditState == LOW && previousditState == HIGH) {
// and it's currently pressed:
Keyboard.press(91);
delay(50);
}
if (ditState == HIGH && previousditState == LOW) {
// and it's currently released:
Keyboard.release(91);
delay(50);
}
// Update previous states
previousdahState = dahState;
previousditState = ditState;
}
void updateOutputs()
{
digitalWrite(myLED_LED_PIN_D2, myLED_LED_PIN_D2_rawData);
}
/* END CODE */